Force update sensor from HA



  • Hi,

    I've got a sketch with Button+Relay which can operate independently from the HA (falling edge of button -> toggles relay). The HA can also trigger the change and it is correctly reflected (by switching on/off -> changes relay to on/off). I am also able to read the HA state when the sketch launches so that the state of relay is correctly brought back on sketch startup.

    However I am not sure how should I force update of relay status from HA when it misses some events or HA is off while the sketch is still doing its job. In such case until there's a change triggered by Button or from the HA there is a discrepancy of states (actual vs. shown in HA).

    Is there a way to check these states when HA is starting up. Also I would like to check it periodically to ensure I am in sync.

    Cheers,
    Bart


    Log in to reply
     

  • Plugin Developer

    @Bart

    Mysensors devices push their updates to home assistant. You can push an update to home assistant at a regular interval. If the state is the same as before in home assistant, a state change won't happen, so it should be harmless.

    For sensors, ie not actuators or binary sensors, I will soon implement forced updates, which mean an update from a sensor device will always force a state change, even if new state is the same as old state. This will enhance recording of sensor values eg when the same value is reported consecutively.

    Regarding syncing state at home assistant start, I think this can be solved for non sleeping devices by using discovery, I_DISCOVER, messages. This is on my todo.


Log in to reply
 

2 out of 2

Suggested Topics


  • Announcements   8 Apr 2014, 07:05

    1

  • Home Assistant   15 Jan 2024, 10:26

    3

  • Home Assistant   15 Oct 2024, 20:33

    3

  • Home Assistant   5 Oct 2024, 10:31

    5

  • Home Assistant   1 Sept 2024, 20:57

    1

8
Online

11.5k
Users

11.1k
Topics

112.8k
Posts