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


  • 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
 

Suggested Topics

  • 1
  • 1
  • 3
  • 3
  • 17
  • 2

20
Online

11.4k
Users

11.1k
Topics

112.7k
Posts