Closed ShonP40 closed 1 year ago
As a temporary solution, people who encounter these freezes can also setup an automation that restarts the addon automatically
mqtt:
binary_sensor:
- name: PIMA Status
state_topic: "alarm/status"
icon: mdi:server
value_template: '{{ value_json[''logged in''] }}'
payload_off: true
payload_on: false
json_attributes_topic: "alarm/status"
expire_after: 60
device_class: problem
automation:
- alias: 'PIMA: Restart on freeze'
trigger:
- platform: state
entity_id:
- binary_sensor.pima_status
to: unavailable
condition: []
action:
- service: hassio.addon_restart
data:
addon: {Replace with your addon ID}_pima
mode: single
I believe the above "workaround" (as you call it) actually works fine in some environments. 👍
I've learned that the errors like "not enough data" may be related to the hardware used to communicate with Pima. Over the last two years, I've used the PIMA Alarm integration with three different TTL devices:
The first was with a Raspberry PI Zero, that I installed inside the alarm box. It was running the Pima/Alarm service, and communicating with Home Assistant over the LAN via MQTT.
It worked fine but got the "not enough data" error every other week, so I added an automation, like the one @ShonP40 suggested above, to restart the Alarm service whenever it stopped working. This worked OK for me.
After a year, I decided that I don't want to have a PI "computer" just as a connection to Pima, so I replaced it with a PL2303TA cable, and started running the Pima/Alarm as a HomeAssistant AddOn.
This device was working only for a few hours every time, until hanging. I had to reboot my Home Assistant's main Raspberry PI or physically disconnect and reconnect it to the USB connector in order to make it work again. It is a disappointment for me.
There was a 2-3 celsius degrees increase in the Raspberry PI temperature whenever the PL2303TA is connected to it.
I bought it here: https://www.aliexpress.com/item/32345829369.html
Per the recommendations on Tasmota forums for the CH340G, I replaced the PL2303TA with it.
It is much better now. I've installed it a week ago. So far it didn't show any issues. I also do not see it impacting the PI's temperature.
I bought it here: https://www.aliexpress.com/item/32761423124.html
I'm currently using an FT232RL adapter that's plugged into an RPi 4, but I'm planning on connecting the PIMA system straight to the RPi's UART pins soon to keep it more compact.
Cool!
I'd love to hear how well the AddOn works with the PI's UART. I didn't yet try.
Ended up giving up on trying to use the RPi's UART because Home Assistant OS keeps resetting every config.txt
change I add on reboot
I installed this project as an Home Assistant addon and noticed that every about 30-60 minutes, it would just freeze with a
not enough data...
error and never exit, resulting in HA's watchdog not detecting it as a crash & not restarting the addon.This PR should resolve this issue completely by exiting when these errors occur, prompting watchdog to restart the addon.
(This should also resolve issue #9)