I’m quite new with Hassio.
I would like to change the color of a light icon “ingresso” when the status of a second light “status ingresso” changes.
I was able to send a telegram message, with an automation as on the following configuration
configuration file …
-
platform: mqtt
name: “ingresso”
command_topic: “cmnd/corridoio1-3/power”
state_topic: “stat/corridoio1-3/POWER”
payload_on: “ON”
payload_off: “OFF”
availability_topic: “tele/corridoio1-3/LWT”
payload_available: “Online”
payload_not_available: “Offline”
qos: 1
retain: false -
platform: mqtt
name: “status ingresso”
command_topic: “cmnd/corridoio1/status/power”
state_topic: “stat/corridoio1/status/POWER”
payload_on: “ON”
payload_off: “OFF”
availability_topic: “tele/corridoio1/status/LWT”
payload_available: “Online”
payload_not_available: “Offline”
qos: 1
retain: false
Automation file …
- id: icona luce ingresso
alias: Telegram icona luce ingresso
trigger: - entity_id: light.status_ingresso
from: ‘unavailable’
platform: state
to: ‘off’
action: - data:
message: Allarme accensione in ingresso
title: Accensione ingresso
service: notify.telegram_bot
but I don’t know how to set up the icon color change of a light (ingresso) on the automation action section, when the availability of another light (status ingresso) changes.
I tried to add this configuration fragment to configuration.yaml, but it does not work:
customize:
light.ingresso:
templates:
icon_color: >
if (light.status_ingresso.state === 'unavailable') return 'rgb(0, 0, 255)';
return 'rgb(255, 0, 0)';
Please note these are the 2 states:
- [light.status_ingresso] unavailable
- [light.status_ingresso] off
Anybody can help me ? Thank You very much in advance.