Hi,
I’ve following problem how to configure home assistant. My setup works on Odroid HC1 board and I’d like to have option to see current power usage and stats using xiaomi switch, but I want to disable possibility to change the switch state, because if I accidentally turn it off, then there is no option to ever turn it back as the home assistant dies
Is there any way to show only the switch in “read only mode”?
There is no option for a read-only switch, but you can create a template binary sensor that will read the value of the switch and display it.
Then create a group that only has the switch you want to keep and the value_template sensor showing on/off.
use card type glance instead of entities.
I feel you.
I’m looking for the same idea, for the same reason.
If we can’t make HA have read only switches, maybe block TCP towards that switch IP port to it at the firewall
I am late to the party (and new to homeassistant)
Just found the tile
card type.
In tile cards you can configure the Tap Action
and Icon tap action
for the (switch) entity.
When setting both actions to No Action
we get read only switches in the dashboard view.
The easiest way to disable a toggle (any input helper) in Entities card is card-mod.
This is a bit of an old thread, but since I recently also wanted to have a ‘read only’ switch for my real switch on the desktop, I stumbled across it.
I found a little solution with the standard resources. To do this, I used a helper (Input.Boolean) that shows a (virtual) switch on the desktop and two automations.
Turn off automation
The turn on and turn off of the real switch and the status change of the desktop switch are considered triggers.
As conditions, it is checked whether the real switch is turned off.
The ‘Input boolean: Turn off’ for the desktop switch entity is defined as actions.
Turn on automation
The turn on and turn off of the real switch and the status change of the desktop switch are considered triggers (same as the other automation).
As condition, it is checked whether the real switch is turned on.
The ‘Input boolean: Turn on’ for the desktop switch entity is defined as actions.
With that, the virtual switch shows allways the current state of the real switch. If the desktop switch is changed, it immediately jumps back to the correct state. This gives me a desktop switch that displays correctly, without actually being able to switch anything on or off.
I’ll just bump this up to save someone time on building it and have it in a single automation (which does similar to what @pitg said). It tracks whether user or automation changed the value. Allowing only for automation changes… Replace your input_boolean
and you’re good to go.
alias: Kids Bedroom. Humidifier. No Water governor.
description: ""
trigger:
- platform: state
entity_id:
- input_boolean.kids_bedroom_humidifier_low_water
condition:
- alias: Triggered by User, not Automation/Script
condition: template
value_template: "{{ trigger.to_state.context.user_id != none }}"
enabled: true
action:
- service: input_boolean.turn_{{trigger.from_state.state}}
data: {}
target:
entity_id: "{{trigger.entity_id}}"
mode: single
…or you may just disable the toggle )
yeah, but than i have to use the card-mod. I don’t want to have lots of foreign dependencies.
- But anyway you may be using 3rd party integrations…
- Another reasons to use an automation:
– you need to provide a card-mod to disable a toggle in EVERY card where this toggle is shown;
– in more-info card for this binary entity (input_boolean or switch) - you also need to provide a way to disable the control.