I can control and monitor only the relays.
If I move the cover by the wall buttons, from HA I can see the state of the relay.
So I suppose that if I ALWAYS monitor the states of the relay (by counting the seconds of movement) the position will be always updated…
I suppose that “cover time based” works like this:
-when I call cover.close_cover/cover.open_cover it starts counting and stops the cover when the position (time) is reached
My idea is start counting when the relay open/close… in this way the position is updated when I use the wall buttons also…
Is there a way to avoid creating switches to be used with that custom component to control cover.
I already have working cover object.
In order to integrate that component, I would have to create via script the open/close/stop switches via script but there are already cover object. Might be that there is a direct command I not aware of to avoid this scripting.
I do have native cover from RFXTRX integration that provide native cover objects from RTS somfy shutters.
The custom component documentation explains it this way as far as I remember : considering the variety of devices and behavior, the most adaptive way to do is to let the configuration be done by the end-user in a script.
It is a one-time job ; as I posted months ago, I managed to do it with my configuration which seems as yours whereas it was my first sript in HA and my making it up.
When this is done, original cover objects are not to be used, and even they should be put apart to avoid the lost of the position by the time counting in the custom component. It is not a problem when you totally forget them in the UI and automations.
The Custom Component works very well in Google Home by voice commands without further setup. It naturally integrates in my Nodered automations in parallel. I can even use this custom card should I want a slider command in the UI : slider-entity-row. So I am more than happy with it.
Hi all
I have some tuya switches for my covers with 3 buttons eash. up-down-stop.
They don’t report position so I would like to try this component, because I need to know approximately their position.
since I have only one switch for each cover should I use the same entity in
the open_switch_entity_id: and close_switch_entity_id ?
Hello, @robi & @davidramosweb . Thank you both for this integration, got it “almost” working with the @robi RF variant.
But I need a little help here, not sure if possible: My case, and what I have:
Control by Broadlink RF - the SAME command for OPEN / CLOSE / STOP.
Door sensor that only monitors CLOSED state.
Gate funtionality:
if gate is CLOSED - RF command OPENs it.
if gate is OPEN - RF command CLOSEs it.
if gate is OPENING - RF command STOPs, and next command will be to CLOSE.
if gate is CLOSING - RF command STOPs, and next command will be to OPEN.
How should I do this logic? In the button created by the integration, if gate is OPENING and I press it again, it starts CLOSING, does not STOP.
Thanks again, both, and in advance to anyone for the help!
To use the door sensor, already have this automation:
Well, maybe replying to my own question, although it’s not ideal because it overrides the cover functionality, maybe I must change the “toggle” action of the button for a custom script that follows this logic. It will only work in Lovelace where I set it up, not directly with Google assistant, for example.
Is there other way? Maybe customize the code? Not a programmer, though…
My logic for the script that will replace the button “toggle” action:
### Support variable:
input_select.gate_next_action = ['Open','Close']
### Logic (NOT programmning language):
if <gate = closed > then (call-service.open_cover)
if <gate = opening > then (call-service.stop_cover + define input_select.gate_next_action = 'Close')
if <gate = closing > then (call-service.stop_cover + define input_select.gate_next_action = 'Open')
if <gate = open AND position = 100 > then (call-service.close_cover)
if <gate = open AND position < 100 > then
- if input_select.gate_next_action = 'Open' then (call-service.open_cover)
- if input_select.gate_next_action = 'Close' then (call-service.close_cover)
Any other suggestions on how to do this? It would be better if this funciontalitty could be in the cover itself. Is it possible to add new service and next_action data to the custom cover that reacts like this? Maybe call it “selective_action” instead of “toggle”?
Since ESPHome v1.15.0 (September 13, 2020) it’s possible to create nativeTime-Based covers, where timing is intelligently handled by the ESP hardware itself. Home Assistant just gets standard covers with position setting.
Possible with RF codes on Sonoff RF Bridge too. You can have as many such covers as you want all built-in the same RF Bridge, even with Open/Close commands appearing on the web interface of it:
I tried it, but cover goes over the target, I think it depends my shutters work: one pulse to open, another pulse to stop (same for close button).
May be I will implement a stop comand when shutter reach the target value.
the problem is set_known_action service that overwrite target position.
I solved it with two code changes:
def auto_updater_hook(self, now):
"""Call for the autoupdater."""
self.async_schedule_update_ha_state()
if self.position_reached():
_LOGGER.debug(self._name + ': ' + 'auto_updater_hook :: position_reached')
self.stop_auto_updater()
self._target_position = 0 #jump396
self.hass.async_create_task(self.auto_stop_if_necessary())
and
async def set_known_action(self, **kwargs):
"""We want to do a few things when we get a position"""
if (self._target_position == 0 or self._target_position == 100): #jump396
action = kwargs[ATTR_ACTION]
if action not in ["open","close","stop"]:
raise ValueError("action must be one of open, close or cover.")
if action == "stop":
self._handle_stop()
return
if action == "open":
self.tc.start_travel_up()
self._target_position = 100
if action == "close":
self.tc.start_travel_down()
self._target_position = 0
self.start_auto_updater()
Hello !!!
how to fix the warning appears 1 time when the HA server boots
Using Cover Time Based Component
Logger: homeassistant.helpers.entity
Source: helpers/entity.py:549
First occurred: 23:20:28 (4 occurrences)
Last logged: 23:20:28
Entity cover.roleta_detskaia (<class 'custom_components.cover_time_based.cover.CoverTimeBased'>) implements device_state_attributes. Please report it to the custom component author.
Entity cover.roleta_gostinnaia (<class 'custom_components.cover_time_based.cover.CoverTimeBased'>) implements device_state_attributes. Please report it to the custom component author.
Entity cover.roleta_kukhnia (<class 'custom_components.cover_time_based.cover.CoverTimeBased'>) implements device_state_attributes. Please report it to the custom component author.
Entity cover.shtora_spalnia (<class 'custom_components.cover_time_based.cover.CoverTimeBased'>) implements device_state_attributes. Please report it to the custom component author.