asantaga / wiserHomeAssistantPlatform

Platform and related climate/sensors to support the Drayton Wiser Home Heating System
MIT License
237 stars 44 forks source link

Climate Trigger event not firing after upgrade to 3.4.12 #526

Open 2d53 opened 1 day ago

2d53 commented 1 day ago

I have automation to turn on a switch, triggered when climate.wiser_bathroom starts heating, and to turn it off when it stops heating. Has worked perfectly for a year. After upgrade to 3.4.12, the triggers did not fire at all. Nothing in the logbook.

Reverted to 3.4.10 and everything back to normal, and the logbook shows

Bathroom UFH On triggered by event 'wiser_event'
10:29:52 - 16 minutes ago
ShellyP1PMUFH Switch 0 turned on triggered by automation Bathroom UFH On triggered by event 'wiser_event'
10:29:52 - 16 minutes ago

Example of the automation

alias: Bathroom UFH On
description: ""
mode: single
triggers:
  - device_id: 82a3c4c7a46f7df03930d13530027fac
    domain: wiser
    entity_id: climate.wiser_bathroom
    type: started_heating
    trigger: device
conditions:
  - condition: state
    entity_id: input_boolean.holiday
    state: "off"
actions:
  - type: turn_on
    device_id: dae819da62210423b3f67ea1758117f8
    entity_id: f3c5a8543ffaff662b39c2124fd7710b
    domain: switch
msp1974 commented 1 day ago

Just tested and yes it is not working for anything that is a true/false event. I will fix in next release. In the meantime, either downgrade to v3.4.11 or you can amend the following code.

In custom_components/wiser/events.py change line line 70 from

            hasattr(old_state, event[CONF_ATTRIBUTE])
            and getattr(new_state, event[CONF_ATTRIBUTE])
            and getattr(old_state, event[CONF_ATTRIBUTE])

to

            hasattr(old_state, event[CONF_ATTRIBUTE])
            and getattr(new_state, event[CONF_ATTRIBUTE]) is not None
            and getattr(old_state, event[CONF_ATTRIBUTE]) is not None

Like this (now in dev branch) - https://github.com/asantaga/wiserHomeAssistantPlatform/blob/2eb70fc9c6d397c86c92f433ec5fad7ea2c132ba/custom_components/wiser/events.py#L71

2d53 commented 1 day ago

Thanks for the prompt response Mark. I'll stay at 3.4.10 until the next release comes out.