-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTo implement.txt
executable file
·73 lines (44 loc) · 3.64 KB
/
To implement.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
################ ESP32 ################
- Bluetooth connectivity for communicating ssid and pw
now working, error handling and comments needed
- Encrypt MQTT communication
- Implement OTA updates
#### DONE ####
- Script that takes device id (/dev/tty.SLAB_USBtoUART), original file(s) or folder paths, destination path,
REMOVES ALL THE COMMENTS FROM THE CODE AD SENDS IT TO THE ESP
working using sudo:
sudo python3 esp_loader.py /Users/giovannichiementin/Desktop/Terra/terra-monorepo-1/ESP32_repo/ESP32/main_.py
- Problem in method try_reconnect, it recursively calls itself, esp doesn't reset after a certain time
Removed callback to calling function and inserted MAX_RECONNECTION_ATTEMPTS monitoring
- Subscription lost after msg_wait(), better to subscribe to {base_topic}/# so that it's easy to resubscribe after connection error.
A bit annoying because the esp would now receive its own messages,
CREATED FUNCTION initialize_subscriptions() TO CALL ON msg_wait() errors (cleaner solution)
- Add listen on trigger topic for resending id and type
Now listening on "/esp32/broadcasted_command" for every broadcasted communication.
- error logging needs to happen both through mqtt and locally in error_log.txt .
insert function to send error_log.txt file through mosquitto if requested.
USELESS TO SEND ERRORS TO THE RASPBERRY, AS MOST OF THEM ARE CONNECTION ERRORS (thus mqtt is not available anyway)
just log them and try to reconnect if fatal error.
- Figure out a way to easily select the specific sensor folder
Just named the folders with the same name and standardized it
################ RASPBERRY ################
- Create a dictionary containing a structure of the grow box (user_id/box_id/ESP_id/sensor_id)
- ? Function to translate esp32_index/sensor_index into ESP_id/sensor_id (using the aforementioned dictionary)
- Separate listener and talker from main logic.
- When actuator esp is connected, immediately send on or off state according to the previous state (maybe after blackout)
- If a device present in the dictionary is not found after n second, show error to user (with possibility to forget the esp)
- Rorganize and restructure the callbacks.py file, maybe put it together with the mqtt.py file.
- Wifi usb module for immediate connectivity, in the ESP put a file with a preconfigured ssid and password.
- Send datetime every day
- Error handling for the callbacks
- MQTT broker should require the appropriate access permissions.
- Save water amount after every irrigation
#### DONE ####
- Remove error topic to simplify the code.
- Possibility to forget esp32 devices (from dictionary)
use the method device.remove_device(esp32_id, esp32_type) in utils.py, Devices class.
- If system reboots, send message to ESPs for asking names (to solve the error in which a new device is added before turning on the program)
now publises on /esp32/broadcasted_command the message {'command':'identify'}, the esps are always listening to this topic.
################ GENERAL ################
- if a method or function isnt ready for edgecases or needs error handling, comment it with ### GENERAL TO HANDLE ### + reason why
- MQTT communication should be encrypted in both raspberry and esp32.