Controlling dimmers with a script

Hi HA experts,

I’m controlling 3rd party dimmers with an external script, with the following config :
input_number:
office_dimmer:
min: 0
max: 100
step: 10
name: Bureau Eclairage
bedroom_dimmer:
min: 0
max: 100
step: 10
name: Chambre Eclairage

shell_command:
level_office: /srv/homeassistant/scripts/Dimmer.py 80 {{ states.input_number.office_dimmer.state | int }}
level_bedroom : /srv/homeassistant/scripts/Dimmer.py 63 {{ states.input_number.bedroom_dimmer.state | int }}

Automation

  • alias: “Office Dimmer”
    trigger:
    platform: state
    entity_id: input_number.office_dimmer
    action:
    service: shell_command.level_office
  • alias: “Bedroom Dimmer”
    trigger:
    platform: state
    entity_id: input_number.bedroom_dimmer
    action:
    service: shell_command.level_bedroom

The control works, but if someone hits the dimmer, HA has no feedback.

My script can read the dimmer level, no problem with that.

How can I adjust the variable ? In my case that would be office_dimmer / bedroom_dimmer

Thanks for your help !

Johan