If a light entity is added to a lovelace card, it is possible to switch on/off the light.
I want the option to to disable the manual on/off switch of the light entity in lovelace.
In my use case, i switch the light over a motion sensor (KNX device). So I want to know the status of the light on a lovelace card, but it is not possible to switch this entity on/off (somebody could fall down the stairs if the light is turned off manually…)
To turn on/off the light, the motion sensor usually offers an external switch input. So I can turn on this light over a binary_input entity that is connected to the motion sensor external input.
You can’t with a standard “Entities” card, unless you want to create a template binary sensor, but if you use a “Button” card you can switch the tap action and hold action both to “No Action” and it will still show the status, but it won’t be able to act on the switch.
In this grid card, both of these buttons represent the same device. The button on the left has no actions, but it shows the correct state if toggled by the button on the right:
Great feedback. The binary_sensor with device_class: light is exactly what i was looking for. Is there a posibility to change the text? I only need ON or OFF as text not “light detected”.
The device_class defines the text (and the default icon). The icon can always be customized. Imho that’s all there is to a binary_sensor UI wise.
If you don’t like the text use a different device_class.
IOkay, but that involves to use hacs and mod the complete card. don’t want taht. So how do I convert a light into a binary sensor or how do I create an extra binary sensor for the bulb?
Benieve in code is what I tried in configuration yaml, but now I get: This entity (‘binary_sensor.patio_light_binary’) does not have a unique ID, therefore its settings cannot be managed from the UI. See the documentation for more detail.
binary_sensor:
- platform: template
sensors:
patio_light_binary:
friendly_name: Patio light Binary
entity_id: light.patio_light
value_template: >-
{%- if is_state("light.patio_light", "on") -%}
licht is aan
{%- else -%}
licht is uit
{%- endif -%}
I used this type to detect the status of a light controlled by a motion sensor. On the dashboard you use a standard “element” card and use a light bulp icon. In this case “mdi:lightbulb-auto”. In the card you activate “colore icons based on state”.
Is that what you are looking for? If not please try to explain you are use case…