Prevent Zigbee button from activating

I have 6 zigbee buttons. Alll of them are used to turn a light on or off.
For example I have one at my bedside so I can turn the lights off after reading, with out getting out of bed.
Every time that home assistant is restarted if the light is off it turns on, and if the light is on it turns off.
How can I stop home asistant from causing a button press when it is restarted.
Thanks

Are you using ZHA or Zigbee2MQTT ?

Zigbee2MQTT

Trying creating a helper that the switches toggle then the helper turns on or off the lights. On HA restart the value of the helper will not change.

Thank you for the suggestion.
I have created a few helpers, but would you mind walking me through this because I do not understand what to do.
Thank you and Happy New Year.

I suspect that undesirable behavior may be due to the choice of trigger used in the automation that controls the light.

Post the automation(s) used to monitor the ZigBee buttons.

Settings then Device & Services then Helper then Create Helper then toggle then create a name.

Also post the automation so we can check the flow. You can also check traces to see what trigger the automation.

Here is the one for the light in my Master Bedroom.
All other devices are similar except for the device_id.
I am using a Third Reality zigbee button in zigbee2mqtt.
Thank you.

####################################################
#  MASTER BEDROOM LIGHT ON/OFF    2023Oct21        #
####################################################
- id: "14b6500d-44a3-496f-97de-d18739cff023"
  alias: "Master Bedroom Light ON"
  trigger:
  - platform: state
    entity_id:
    - sensor.button_master_bedroom_light_action
  condition: []
  action:
  - service: light.toggle
    data: {}
    target:
      device_id: 805e1a3607391dcf3fc85acc378ee93b
  mode: single   
####################################################
#            END OF CONFIGURATION FILE             #
####################################################

That State Trigger will trigger for any change in the sensor’s state value including from unavailable to a known value (and if the sensor has attributes whose values can change, it will trigger when one of those values change). On startup, depending on the entity’s integration, its initial state value can be unavailable for a moment before it changes to a nominal value.

Modify the State Trigger so that it doesn’t trigger when the sensor’s changes from unavailable/unknown to something else.

  trigger:
  - platform: state
    entity_id:
    - sensor.button_master_bedroom_light_action
    not_from:
    - unavailable
    - unknown 
    to:

From the State Trigger’s documentation:

@123 You are a genius.
I have been playing with this for over 5 months.
It now works.
Now when I reboot I no longer have to go in and turn off all the lights and my shop equipment.
Thank you so much, and Happy New Year.

1 Like

You’re welcome!

Please consider marking my post above with the Solution tag (as opposed to your own). The custom is to mark the first, or best, post that provides the answer/solution to the original question/problem.

By marking the post with the Solution tag, it will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. It places a link below the topic’s first post that leads directly to the Solution post. This helps users quickly find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.