Skip to content

Can bus to mqtt#130

Open
ArnavSingh04 wants to merge 61 commits intomasterfrom
CanBus-Wifi
Open

Can bus to mqtt#130
ArnavSingh04 wants to merge 61 commits intomasterfrom
CanBus-Wifi

Conversation

@ArnavSingh04
Copy link
Copy Markdown

changed main.cpp and sensor base to connect to wifi and mqtt instead of sending to raspberry via canbus

lim-joseph and others added 30 commits September 13, 2024 16:54
…s for each sensor with their implementations, now each sensor .chh file is a child of the sensor base
Copy link
Copy Markdown
Contributor

@AroshHeenkenda AroshHeenkenda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things so we can thorougly test this before any merges.

  • I left a comment about using config/.env files, please take a look at that
  • Could we please get some steps to test this on our own devices?
  • You have a lot of print statements in here which is good, but it would be better if these went to a .log file (which would be gitignored), that way we can track what happens on a device accurately.

Log file printing should follow a message format like below:

[yyyy/mm/dd hh:mm:ss] [message_type] log_message

e.g.
[2025/07/17 12:25:00] [INFO] Connected to MQTT service.

Comment on lines +16 to +18
const char* ssid = "A 2 jang pura extn_5G";
const char* password = "act12345";
const char* mqttServer = "192.168.0.117"; // will replace it later with raspberry's IP
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These shouldn't be written and committed directly into the main file. Instead we should use a .env or some similar type of configuration file. The contents of this file in this case will contain something like the below:

SSID="some_SSID"
PASSWORD="some_password"
MQTT_SERVER="ip_for_server"

The main.cpp will read from this file, the file should also be gitignored so we don't put these secrets onto Git. This way for anyone's test environment they can play around with the values to make it work and it keeps our data confidential. Let me know if you have any questions about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants