Closed kitoban closed 9 months ago
I also find that the start on boot doesn't work.
My suspicion with this is that home assistant is not ready for the calls to
curl -s -X POST -H "Authorization: Bearer $HA_LongLiveToken" -H "Content-Type: application/json" -d '{"attributes": {"unit_of_measurement": "Ah", "friendly_name": "Battery Capacity"}, "state": "'"$battery_capacity"'"}' $HTTP_Connect_Type://$Home_Assistant_IP:$Home_Assistant_PORT/api/states/sensor.solarsynk_"$inverter_serial"_battery_capacity $EntityLogOutput
to work and so the run.sh shutdown due to the api not being spooled up.
Might be adding some code to test the API state before pushing to it:
https://developers.home-assistant.io/docs/api/rest#actions
Looks like curl \ -H "Authorization: Bearer TOKEN" \ -H "Content-Type: application/json" http://localhost:8123/api/
might do the job to interrogate if the api is up, and if not put a wait on till it is.
The issue is that when ever there is an error response the script will stop. I.E if internet goes down and it can no longer reach the sunsync server it will crash. Same with when Homeassistant rebooted , its most probaly trying to access sunsynk whilst the network card has not yet been initialized or of the HA api is not ready.
Unfortunatly HA's watchdog does not keep on trying to start it as it may lead to other issues if it indefenitly tries to start tje scrip.
Cheap solution would be to put the entire script in an error trap.
Will take a look later in the week to see if there is a solution.
I corrected the problem. The addon should now automatically start if you reboot or when t here are errors due to the unavailability of the Sunsynk server.
"check for updates" refresh the page and then go into the addon you will see the update. I also added the date and time at the start of the script to indicate the script's execution date/time so that you can see when last it was executed.
Thanks for reporting the issue.
I've updated and it seems to work. Thanks for the quick fix.
Have been finding that start on boot setting does not seem to start the addon up. Mostly noted on upgrade restarts however I suspect that if there is a fault on the addon then watchdog is also not able to restart.