I have a homemade light fixture with RGB lighting and different modes. I’m trying to integrate it into Home Assistant, so far only on/off and brightness. From what I understand, you can’t read the response from rest_command, so I created a sensor, however by default the sensor is updated every 30 seconds, but even if I put 1 second it still creates a delay on the card in the frontend, not to mention I don’t want the endpoint to be called all the time. Is there any solution to make the sensor update immediately only when any action is performed on the lamp? Or any other solution
sensor:
- name: 'RGB Lamp Power State'
platform: rest
resource: http://mylamp.local/status
method: GET
value_template: '{{ value_json.data.power }}'
rest_command:
lamp_get_status:
url: 'http://mylamp.local/status'
method: GET
turn_on_lamp:
url: 'http://mylamp.local/power?value=1'
method: GET
turn_off_lamp:
url: 'http://mylamp.local/power?value=0'
method: GET
lamp_set_brightness:
url: 'http://mylamp.local/brightness?value={{ brightness }}'
method: GET
light:
- platform: template
lights:
lamp:
friendly_name: 'RGB Lamp'
value_template: "{{ is_state('sensor.rgb_lamp_power_state', 'True') }}"
turn_on:
service: rest_command.turn_on_lamp
turn_off:
service: rest_command.turn_off_lamp
set_level:
service: rest_command.lamp_set_brightness
data:
brightness: '{{ brightness }}'