gazoscalvertos / Hass-Custom-Alarm

Yet another take on a home assistant custom alarm
221 stars 94 forks source link

Not compatible with HA 0.82.0 - invalid service data/breaks (newUI) #51

Open brillb opened 5 years ago

brillb commented 5 years ago

Describe the bug Unable to use on HA 0.82.0, and likely other 0.80+ versions

To Reproduce Steps to reproduce the behavior: Install on 0.82.0

Expected behavior Panel appears, activates/deactivates

Screenshots

2018-11-05 22:43:32 ERROR (MainThread) [homeassistant.core] Invalid service data for switch.turn_on: expected a dictionary. Got {‘automation.alarm_warning’} 2018-11-05 22:43:43 ERROR (MainThread) [homeassistant.core] Invalid service data for switch.turn_off: expected a dictionary. Got {‘automation.alarm_warning’}

fixed by changing to:

self._hass.services.call(“switch”, “turn_on”, {‘entity_id’:self._config.get(CONF_WARNING)})
self._hass.services.call(“switch”, “turn_on”, {‘entity_id’:self._config.get(CONF_ALARM)})

at all locations which were previously:

self._hass.services.call(“switch”, “turn_on”, {self._config.get(CONF_WARNING)})
self._hass.services.call(“switch”, “turn_on”, {self._config.get(CONF_ALARM)})

Fix in the attached Diff from bwalarm.py v1.1.2: bwalarm-diff1.txt

also diff for alarms.html (missing two break statements) alarmshtml-diff1.txt

adipose commented 5 years ago

Do you have 1.04?

adipose commented 5 years ago

In 1.04 those lines don't seem to exist. Instead, similar lines are present:

self._hass.services.call("switch", "turn_off", {self._alarm})

brillb commented 5 years ago

This is branch "newUI", much more recent than 1.04. I downloaded the code just 3 days ago, it's v1.1.2 as you can see currently here: https://github.com/gazoscalvertos/Hass-Custom-Alarm/blob/newUI/custom_components/alarm_control_panel/bwalarm.py

BenchPressesBooks commented 5 years ago

I have noticed that MANY of the files uploaded have extraneous spaces and tabs, one of them had windows line endings instead of linux. After cleaning everything up and replacing all tabs and indents with two spaces it cleaned up A LOT of problems with the function in .82. I am still finding issues with CSS ordering and everything in mine causing some UI oddities on strange sized displays like the 7" Raspberry pi. I may try to put in a merge request eventually unless gazoscalvertos is going to commit updates soon. I noticed quite a few broken features and would love to clean up and contribute to the latest!

adipose commented 5 years ago

@brillb ah, I see. I wasn't even aware of that branch.