Apologies for resurrecting this topic, but is this custom component still a working solution 2.5 years later?
I’ve finally updated my Home Assistant and have also updated the code in the repo to work with the newer versions ( 2023.11.3).
This is great, thank you. I’m also running a setup with just one magnetic reed sensor for closed and with your component I’ve got this faking the opening and closing status.
This is the code that I’m using:
cover:
- platform: pcc
covers:
garage_door:
device_class: garage
friendly_name: "Garage Door"
unique_id: garage_door_cover
# travelling_time_down: 17 #not needed with closed sensor
travelling_time_up: 15
value_template: >-
{{ is_state('binary_sensor.garage_door_garage_door_contact', 'on') }}
open_cover:
service: switch.turn_on
target:
entity_id: switch.garage_door_trigger
close_cover:
service: switch.turn_off
target:
entity_id: switch.garage_door_trigger
stop_cover:
service: switch.turn_off
target:
entity_id: switch.garage_door_trigger
Two things that I’ve noticed:
- While home assistant is booting, the cover shows as
open
whilebinary_sensor.garage_door_garage_door_contact
isunavailable
. I would have thought the template would return false in that condition. travelling_time_up: 15
seems to overridevalue_template:
- I can see this by closing the door shortly after opening it. The state stays asopening
for the full 15 seconds, then goes straight to closed.
Great custom component, maybe this can be done with the template platform but I wasn’t able to achieve it - thankyou
For anyone using this in late 2024. ( me, I just started using it. =) )
Noted that when I tried to use it the PCC-entity was not created.
Found in the logs that it had some deprecation warnings and was not thread safe.
Created a pull request that solves these issues and now the entity is created successfully.
Removed SUPPORT_* will be deprecaded in 2025 warning
Note: There is still a unfixed issue when restarting HA that I did not solve (noted in the pull req).
How would I make use of the opening / closing state in a cover template? Template cover - Home Assistant
I do have a MotionBlind in use, unfortunately it only reports the states open / close along with the current position. opening/closing are not reported.
My goald would be to show the state “closing” when it goes from 100% do anything lower and reaches the set position for x-amount of seconds.
And vice versa, for “opening”.
Any ideas?
Start by testing if changing the entity’s Show as to Window. This option is available by selecting the entity in Devices & Services then clicking the gear in the top right corner.
That would have been a neat fix! Unfortunatley, no change, still reporting open/close but not opening/closing… Will need to start looking at the value_template documentation, I think that “last_updated” of the entity can be used, but will need to investigate more deeply. What would be great if there is a way to easily-judge if the attribute-value is decreasing or increasing in a template (without a helper)
You’ll have to follow this for that option
value_template template (Optional)
Defines a template to get the state of the cover. Valid output values from the template are open
, opening
, closing
and closed
which are directly mapped to the corresponding states. In addition, true
is valid as a synonym to open
and false
as a synonym to closed
. If both a value_template
and a position_template
are specified, only opening
and closing
are set from the value_template
. If the template produces a None
value the state will be set to unknown
.