In my bedroom I have two RF controlled vertical sun covers and two Zigbee controlled window sensors.
As the windows open outward, and the sun covers are on the outside, I need to be careful not to try and close the covers when a window is open, as the open window will physically prevent the cover from being lowered.
How can I configure homeassistant so that when it receives the command to close the covers (via voice or via a card on the dashboard or whatever), it will not actually execute it when a particular window is open.
There is not a way that I can think of to do this so long as your voice commands and dashboards are interacting directly with the entities provided by the integration that supports your covers.
You can create a Template Cover, which can check the state of the window sensors and then only honor a close command when the window is closed. But you would then have to make sure that your voice commands, dashboards, etc. only interact with the template entity.
Thanks @d921, I hadn’t yet come across this template feature. Sounds like it can act as some kind of wrapper around an existing entity, with the possibility of adding custom behaviour. Might just be the perfect answer to my challenge. I’m going to give it a try.
That’s a way to control the covers with the window sensor as a condition, but that won’t give you a cover entity. You’d instead be triggering the automation (or, it would probably more appropriately be a script) for the covers, while being able to interact more naturally with entities for other aspects of your home that interface with HA. I can’t say for sure that an automation or a script wouldn’t work for OP’s request; but the way the request was posed, it sounded to me like having a cover entity to control is part of the problem statement.
It’s also probably the most natural way to handle the issue, to be honest, though I’m sure there could be reasonable differences of opinion on that.
For the dashboard that’s pretty easy.
Replace the 2 required entites to your setup.
One is a cover in my case driven by a shelly 2pm
The other is a simply reed switch driven by an ESP32
The important one is the “pointer-events: none;” within the card_mod: section of the cover which simply prevents mouseclick being detected.
The rest ist sort of colorized cosmetics.
No idea about voice commands since I talk to humans only not devices, mailboxes, voicemail or other fancy things.
type: entities
title: Rollläden oben
entities:
- type: section
label: Computerraum links
- entity: cover.p2pm_computerraum1
name: Rollladen
card_mod:
style: |
:host {
font-size: 14px;
{% set x = "binary_sensor.esp32computerraump2pm_reed1" %}
{% if is_state(x, 'on') or is_state(x, 'unavailable') %}
color: red !important;
{% else %}
color: white;
{% endif %}
}
hui-generic-entity-row {
height: 25px;
}
hui-generic-entity-row {
{% if is_state(x, 'on') or is_state(x, 'unavailable') %}
pointer-events: none;
{% endif %}
}
}
- entity: binary_sensor.esp32computerraump2pm_reed1
name: Fenster ist
icon: none
card_mod:
style: |
:host {
font-size: 14px;
{% set x = "binary_sensor.esp32computerraump2pm_reed1" %}
{% if is_state(x, 'on') or is_state(x, 'unavailable') %}
color: red !important;
{% else %}
color: white;
{% endif %}
}
hui-generic-entity-row {
height: 15px;
width: 200px;
}
- type: section