koleo9am / hass_max_home_automation

Home Assistant support for MAX! Cube via MAX! Home Automation - HTTP API
The Unlicense
4 stars 7 forks source link

Eco Button is causing errors #10

Closed tiger42 closed 3 years ago

tiger42 commented 4 years ago

I've got the following problem: As soon as I add an Eco Button to my configuration, I get an error in the logfile: Error while setting up platform maxhomeautomation Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for return fut.result() File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/maxhomeautomation/sensor.py", line 107, in setup_platform MaxHomeAutomationSensor (handler, device_name + " - Mode", MHA_SENSOR_TYPE_ECO_BUTTON)) File "/config/custom_components/maxhomeautomation/sensor.py", line 137, in __init__ self.update() File "/config/custom_components/maxhomeautomation/sensor.py", line 184, in update MAP_MHA_OPERATION_MODE_HASS.get(value, None) NameError: name 'MAP_MHA_OPERATION_MODE_HASS' is not defined

The error causes some of the thermostat value entities to completely disappear from Home Assistant: sensor..._temperature sensor..._target_temperature sensor..._valve sensor..._offset

Without Eco Button config: screenshot2

With Eco Button config: screenshot

The Eco Button entities themselves appear in Home Assistant and are working...

koleo9am commented 4 years ago

I have pushed to the github latest version with |MAP_MHA_OPERATION_MODE_HASS added.

Please let me know if it helped.

Thanks.

Ondrej. | Marc-Oliver Stühmer wrote on 07.01.2020 22:09:

I've got the following problem: As soon as I add an Eco Button to my configuration, I get an error in the logfile: |Error while setting up platform maxhomeautomation Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for return fut.result() File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/maxhomeautomation/sensor.py", line 107, in setup_platform MaxHomeAutomationSensor (handler, device_name + " - Mode", MHA_SENSOR_TYPE_ECO_BUTTON)) File "/config/custom_components/maxhomeautomation/sensor.py", line 137, in init self.update() File "/config/custom_components/maxhomeautomation/sensor.py", line 184, in update MAP_MHA_OPERATION_MODE_HASS.get(value, None) NameError: name 'MAP_MHA_OPERATION_MODE_HASS' is not defined|

The error causes some of the thermostat value entities to completely disappear from Home Assistant: sensor..._temperature sensor..._target_temperature sensor..._valve sensor..._offset

With Eco Button config: screenshot2 https://user-images.githubusercontent.com/1204683/71929387-cac6b980-3199-11ea-8bab-4b4f95ad65dd.jpg

Without Eco Button config: screenshot https://user-images.githubusercontent.com/1204683/71928464-e92bb580-3197-11ea-959c-98f10362b1fc.jpg

The Eco Button entities themselves appear in Home Assistant and are working...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/koleo9am/hass_max_home_automation/issues/10?email_source=notifications&email_token=ABIIPGLWHFVX6EQOOK4VYGLQ4TVRNA5CNFSM4KD7DXV2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IETCBUQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIIPGLTPBV3IKMY6YXKTFLQ4TVRNANCNFSM4KD7DXVQ.

-- Sent from Postbox https://www.postbox-inc.com/?utm_source=email&utm_medium=siglink&utm_campaign=reach

tiger42 commented 4 years ago

Thanks! Your change really fixed the issue for me! Is there a reason why you added the new dict _MAP_MHA_OPERATION_MODEHASS as a duplicate of _MAP_MHA_HVAC_MODEHASS instead of just changing line 184 of sensor.py to MAP_MHA_HVAC_MODE_HASS.get(value, None)?