Trying to set state of button to off

Need Help Please…

Im using 1 button of external rf remote to control light ON and OFF. i can switch ON and OFF via the home assistant frontend and on the external rf remote. my issue is that i need the home assistant to show the state when i use the external rf button. Using External rf remote; when i press ON, the light ON, state on frontend ON. When I press OFF, the light OFF but home assistant state no change.
here is my binary_sensor config:

  • platform: mqtt
    state_topic: “tele/rfbridge2/RESULT”
    value_template: ‘{{value_json.RfReceived.Data}}’
    payload_on: ‘064283’
    payload_off: ‘064283off’
    name: “Button_A”

alias: “Button_A”

Copy to clipboard

off_delay: 1

script:
button_light_on:
alias: Button Light 4 ON
sequence:

  • service: light.turn_on
    data:
    entity_id: light.rm4_ceiling_light
    mode: single
    icon: ‘icons: mdi- bulb’

button_light_off:
alias: Button Light 4 OFF
sequence:

  • service: light.turn_off
    data:
    entity_id: light.rm4_ceiling_light
    mode: single
    icon: ‘icons: mdi- bulb’

input_boolean:
button_light:
name: Light Button

automation:

  • alias: Light 4 ON
    trigger:
    platform: state
    entity_id: input_boolean.button_light
    to: ‘on’
    action:
    service: script.button_light_on
    id: d2adcbb9f9104852bde6e6f4b55c4d6d
  • alias: Light 4 OFF
    trigger:
    platform: state
    entity_id: input_boolean.button_light
    to: ‘off’
    action:
    service: script.button_light_off
    id: c4dd7c5b6ae44db5a1bd3302b8af46dd

Thank you in advance for the help.

Hey @pnbruckner

Recently started using this script to add the unlock history attributes to my lock summary sensor. The sensor itself loops through all locks and spits out a one line summary listing any unlocked locks, else “All locked”.

It seems the script is working well creating all 10 history attributes and populating the history_1 attribute however 4 seconds later when the lock summary updates its state, the attributes are gone again.

weirdly it was working perfectly for a few days.