-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestions: user defined watchdog, listen to log thru MQTT #26
Comments
Hi, I'm trying to understand your situation:
user serviceable watchdog:feel free to write such a watchdog. The included one can easily be disabled in favor of a user defined watchdog. The only purpose of the included watchdog is to reset a hanging esp8266 unit, which rarely happens now, but it's possible. The lowest reinit of pysmartnode is a machine.reset() though. Question:Your watchdog should reset if it doesn't receive a message within a specified time. Why? If the device hangs, the current watchdog will reset it. If the mqtt connection is lost, it will try to reconnect but you can actually hook into all wifi events. When the mqtt client can't reconnect, it will reconnec the wifi, which will trigger a "wifi down" event, which you can subscribe with a callback by using
(Note: I just realized I had some bugs in the wifi callback.. fixed in a22c23a and c7152b8) BME280Your module looks good! I'd be happy about a pull request once you feel that it works reliable for you. I have 3 suggestions for the module:
posibility to listen, e.g. for some time, a log trace from pysmartnode device via MQTTSorry I can't really follow what you are trying to achieve here. Which device should listen to what log trace?
Thanks for posting. Discussions always help to improve a project. |
Oh, thanks for really detailed answer. BME280: in fact I don't know what's happening. Sometimes it starts showing constant values of all sensors and it never changes. In other case it stops sending numeric values (all no values at all) - HomeAssistant says entity is non-numeric. I don't see MQTT messages of BME, but for other sensor it's ok (DS18S20) and node is alive. Soft reboot sometimes helps, sometimes not. And - it's the reason for the last point - the node log accessible via MQTT (next point). Log: I just want to look at node log without serial connection to ESP8266, so via MQTT. I didn't know it's already sending log out via MQTT. I will try SmartServer. So thanks again and sorry for stealing your time with my amateur approach :-) |
ok so the device is connected to an mqtt broker over a RPI with a GSM module. So there is no broker on that PI. That means a lot of messages will get lost if the broker is unreachable.
When would you stop sending a refresh message? You would somehow need to recognize faulty readings. So if you use a program that analyzes the published BME messages, then you could use a module on the device that just listens to topic "reboot" and resets when it receives a messages there. But of course a watchdog like module would work too. However, you could just as well program a module on the device itself to check for faulty BME readings. BME280: Does it say anything in the logs while it shows constant values? like reading errors maybe? (Guess you don't know yet because you haven't saved the logs from mqtt yet)
Nah you're not stealing my time. You're showing me how to improve my project to make it better and easier to use :) |
Hi,
I am trying to run my first pysmartnode device in the wild and I am thinking about few enhancements:
user serviceable watchdog: a component, that runs a timer (in a scale of hours e.g.) and subscribed to specific MQTT topic; if it not receive a message, it will proceed a soft reboot/ as lowest reintit of pysmartnode as it's possible... Reason: I tried to write my own sensor component BME280 (https://github.com/Nabla128k/pysmartnode/blob/dev/pysmartnode/components/sensors/bme280.py) (beginner's experiment)) and it's not reliable... partially maybe a fault of sensor board itself and outside nearly 100% humidity idk). And it's not easily accessible, I have to take a car, go 20 minutes, go thru garden, unlock cabinet... not forget a laptop in car...). So it would be nice to have a possibility to initiate reboot/reinitialization remotely as a first try.
And a true independent hardware watchdog I think is an overkill.
for the same reason - posibility to listen, e.g. for some time, a log trace from pysmartnode device via MQTT
I am not sure, if I am able to develop such enhancements, so I am posting it here just for consideration and/or maybe to get some guidance/opposing...
The text was updated successfully, but these errors were encountered: