In Order to prevent turning the Powermeter on the Fridge accidentally off, (i think) i need to “mirror” the state of the Switch, and then Disable (Hide?!) the Switch. Sure it will be helpful to see the State of the Switch anyway
Great, working! Thanks for caring for bloody beginners
Looks like Assigning custom Sensors to Areas isn’t possible (if not issuing an unique Id, which scares me a bit) - or did i miss something?
Edit: Oh - when Disabling the “Source” (Switch), the Custom Sensor becomes unavailable. What kinda makes sense, but thats not what i was looking for
Speaking of Goals: I want to prevent a switch to get switched, but still see the Status. Ideally in the same Area, with the same Name. How would one achieve that?
If you use the new template sensor integration instead of the legacy template sensor platform you can assign a unique id. Still no area though.
Using your previous example:
template:
- binary_sensor:
- name: "iot_gosund_1_4" # you are allowed to use spaces and capital letters here if you want to make it pretty.
device_class: power
state: "{{ is_state('switch.iot_gosund_1_4') }}"
unique_id: whatever
Mhmm - and the other Way around: Would then there be a Possibility to Change the existing Entity (coming from Integration) from Switch to Binary Sensor?
I just want to see the State, but prevent accidentially turning it off. And its getting unorganised, having several entities of one Device floating around in different areas…
Of course, on custom Dashboards i can do whatever i want - but it already happend while browsing through the “Master” Dashboard that i turned off. Which is really bad in case of a fridge
You are doing it the correct way. Creating a template binary sensor from the switch and hiding the switch. You can hide the default auto generated dashboard from non admin users.
I have similar fridge power monitors and I also do this just in case:
- id: c860f3d1-400e-4b78-8724-00293bae3d3e
alias: 'Fridge Power Off Alert'
trigger:
- platform: state
entity_id:
- switch.bar_fridge
- switch.kitchen_fridge
to:
- 'off'
action:
- service: notify.telegram_system
data:
title: "⚠️ *Fridge Power off!!!*"
message: "The {{trigger.to_state.attributes.friendly_name}} power is off."
Well, happy to hear at least sometimes i think the most-correct way Still it feels like a workaround, not a true Prevention, if the Switch still is accidentially clickable on the auto generated Dashboard… Well, Things are as they are, looks like i have to live with that
Thank you, really appreciate your quick and precise Support, even for Beginners!
Maybe not a possibility for you but I thought I would share my solution anyway
I use a couple of Wifi based switches that has power meters and I only need the power meter.
When I took it apart to flash Tasmota on them I took a short piece of single strand 1.5 sq mm copper wire (from electrical installation cable) and simply shorted the relay. This way the switch is always on so I do not risk things going wrong.
The software switch still has to be turned on to enable the power monitor in Tasmota but at least nothing bad happens of someone accidently turns the switch off (could be a software bug doing that).
If you do this make sure you use wire rated for the current (1.5 mm2 can carry 13 A) and take care only to do this if the two relay pins on the PCB can be shorted without the wire passing closely to any other metal part. If it passes another PCB trace you have to isolate the jumper wire. You cannot rely on solder mask to isolate mains. And take care the soldering is clean with sufficient solder. If you screw it up you create a fire hazard.
Fine with me. Remember calling services homeassistant.turn_off or switch.turn_off intentionally or by accident will still turn the (active) switch entities off.