New button integration changes state after every boot

Hi!

I have some buttons (the new button integration) that get state changes just after homeassistant boots up which triggers my automations:

LG: set 17 temp has been triggered by state of button.temperature_17_cmd`

while a true button press provides this:

LG: set 17 temp has been triggered by state of button.temperature_17_cmd by service button.press

My automation code:

- id: '1640289816502'
   alias: 'LG: set 17 temp'>   description: ''
   trigger:
   - platform: state
     entity_id: button.temperature_17_cmd
   condition: []
   action:
   - service: input_text.set_value
     target:
       entity_id: input_text.lg_status_helper
     data:
       value: 17 degrees

Is there a better way of getting real presses on my buttons?

Merry christmas!

I use Node-Red for these things, so might not be able to provide a solution, but the reason for you trouble is that the state of many entities in HA at boot will be set to unavailable until HA can get a reading.
Maybe a condition can help rule out the unavailable state.

Thanks for the suggestion, here is what became my solution:

- id: '1640289816502'
  alias: 'LG: set 17 temp'
  description: ''
  trigger:
  - platform: state
    entity_id: button.temperature_17_cmd
  condition:
  - condition: not
    conditions:
    - condition: state
      entity_id: button.temperature_17_cmd
      state: unknown
  action:
  - service: input_text.set_value
    target:
      entity_id: input_text.lg_status_helper
    data:
      value: 17 degrees