JeroenvO / homeassistant-cz20-badge

Connect cz2020 badge from badge.team to home-assistant as binary sensor
MIT License
1 stars 0 forks source link

Alternative restart badge #4

Open arno58 opened 3 years ago

arno58 commented 3 years ago

My Home Assitant configuration did not like your version 18. I must test if it is the shorter names?

I am using the march edition with some of your new code and some of me en a HA automation.

This part i use: elif topic[0] == 'homeassistant' and topic[1] == 'status': if msg == 'offline': print('Hass offline! Rebooting app.') restart()

This part i changed: topic = 'homeassistant/status/240ac4e1d578/0/status/' c.subscribe(topic + "#") topic = PREFIX + '/light/' + NODE_ID + '/' c.subscribe(topic + "#")

This automation i added: alias: Herstart cz2020 description: bij opstarten ha trigger:

JeroenvO commented 3 years ago

Homeassistant should send a message to mqtt topic homeassistant/status as documentend here: https://www.home-assistant.io/docs/mqtt/birth_will/ , it should not need an automation. If you'd like a restart functionality using mqtt, something like that could be implemented. You can also press the OK button now to restart. Also it would be more neat to use a simple 'restart' command instead of a separate offline/online with delay.

This line if msg == 'offline': is not in version 18, thats an older one.

Feel free to make a pull request for these (or other) additions.

arno58 commented 3 years ago

I tried your version and got the following results. I the lights went on, one after the other and then all turned off. After I changed the c.sub sequence(first homeassistant/status) i got an index error.

I have forked your version and I am adding playing sound and music, there is a bug in playing remote music that can be resolved by restarting cz2020, using the birth_will can not be used in this case.

Thank you for your program you have helped me getting on the right way.

JeroenvO commented 3 years ago

i'm sorry, indeed there was a mistake in the discovery. It is now resolved.