Issue #4 added support for having the script run in persistent mode.
However, the error handling/exception trapping is basically non-existent: the script was written with the intent that it'd be called periodically by cron
.
Whilst that can be mitigated by telling docker/systemd/whatever to restart on exit, we should probably look at adjusting things so that errors are handled a bit more gracefully.
Activity
20-May-23 22:30
assigned to @btasker
22-May-23 21:41
There's a good example of this here: https://github.com/bentasker/tplink_to_influxdb/issues/1#issuecomment-1556135654
The plugs can sometimes end up not returning daily readings - there's actually an example cause of this in the code just before that exception is thrown
22-May-23 21:46
The example leads to a question though.
If we detect that
emeter_today
isn't valid, what do we do:Number 1 seems like the worse option, whilst 2 isn't really much better - it's probably better to leave a gap, so that deadman type alerts can fire.
The next question (and I don't know the answer) is whether Tapo devices are also affected by this - I assume that they must be, but I don't know for sure
22-May-23 22:00
mentioned in commit github-mirror/tplink_to_influxdb@90c3130b5697a034683cd2ff74d8f1ceb9580256
Message
Handle scenarios where Kasa smart plugs fail to return daily usage (utilities/tp-link-to-influxdb#6)
22-May-23 22:00
mentioned in commit github-mirror/tplink_to_influxdb@d9652df200e7fb90e6565f8c6aeaa10ddd7da575
Message
Handle Tapo devices not returning daily usage (utilities/tp-link-to-influxdb#6)
I'm not sure whether this can ever actually happen, but handling it doesn't require much extra effort so seems worth guarding against
22-May-23 22:00
mentioned in commit github-mirror/tplink_to_influxdb@b302f8fc18145f9db1cf4a8f20d787b790428025
Message
Add handling at various points in the code which might experience errors (utilities/tp-link-to-influxdb#6)
This is so that an error doesn't cause the script to exit when run in persistent mode
There are two exceptions to this
23-Dec-23 10:28
This was fixed quite a while ago, closing.
I am going to improve the debug logging, but will do so under a dedicated issue.