Custom Component: Cover Time Based

Ok thks,
I was using current master, but now I use an older commit, and it is working well (I think #479 was the problem) !
What you are proposing is doing the same thing as my component, it is nice, I hope it will be soon available in knx in home assistant !
But one thing is that those types of cover need to Remember their state between Home Assistant reboots, and this is done by my component, but not by the knx one, I think there sould be a config option in knx entities to force Home Assistant to remember the state, is this planned ?

It is currently not planned.
Feel free to open an issue, or even better a PR at https://github.com/XKNX/xknx !
Can we know how long the reboot took? If HA was not available for some time, the cover could have moved and the restored state would be wrong. I think a nice alternative could be https://github.com/XKNX/xknx/issues/491#issuecomment-727146543

I suggest we continue the conversation on GitHub or the xknx discord (see xknx.io) since it is getting OT for this thread :wink:

Hi all, i have another problem.

  • Binary Sensors for external commands recognize changes and change the % opened on the bar
  • With activated binary sensors i can’t set the bar to a % value because the curtains don’t stop anymore, just the endpoint. So i can only open or close the curtains if i set a % value in the UI
  • Without the binary sensors everything works finde with the % in the lovelace UI and the curtains stops at the set %

Here my Binary Sensor Automations code:

- id: "Cover starts opening external"
  alias: "Cover: set open action from HA"
  trigger:
    - platform: state
      entity_id: binary_sensor.test_sensor_up
      to: "on"
  action:
  - data:
      entity_id: cover.my_room_cover
      action: open
    service: cover_rf_time_based.set_known_action
- id: "Cover stops opening external"
  alias: "Cover: set open action from HA"
  trigger:
    - platform: state
      entity_id: binary_sensor.test_sensor_up
      to: "off"
  action:
  - data:
      entity_id: cover.my_room_cover
      action: stop
    service: cover_rf_time_based.set_known_action
- id: "Cover stopped external"
  alias: "Cover: set stop action from HA"
  trigger:
    - platform: state
      entity_id: binary_sensor.test_sensor_pause
      to: "on"
  action:
  - data:
      entity_id: cover.my_room_cover
      action: stop
    service: cover_rf_time_based.set_known_action
- id: "Cover starts closing external"
  alias: "Cover: set close action from HA"
  trigger:
    - platform: state
      entity_id: binary_sensor.test_sensor_down
      to: "on"
  action:
  - data:
      entity_id: cover.my_room_cover
      action: close
    service: cover_rf_time_based.set_known_action
- id: "Cover stops closing external"
  alias: "Cover: set close action from HA"
  trigger:
    - platform: state
      entity_id: binary_sensor.test_sensor_down
      to: "off"
  action:
  - data:
      entity_id: cover.my_room_cover
      action: stop
    service: cover_rf_time_based.set_known_action

My Cover and Binary Sensors Entities:

cover:
  - platform: cover_rf_time_based
    devices:
      my_room_cover_time_based:
        name: My Room Cover
        travelling_time_up: 20
        travelling_time_down: 20
        close_script_entity_id: script.rf_myroom_cover_down
        stop_script_entity_id: script.rf_myroom_cover_stop
        open_script_entity_id: script.rf_myroom_cover_up
        send_stop_at_ends: False #optional
        aliases:
          - my_room_cover_time_based   
binary_sensor:
  - platform: mqtt
    name: Test_Sensor_Up
    state_topic: "stat/TestCov/POWER1"
    payload_on: "ON"
    payload_off: "OFF"
  - platform: mqtt
    name: Test_Sensor_Pause
    state_topic: "stat/TestCov/POWER2"
    payload_on: "ON"
    payload_off: "OFF"
  - platform: mqtt
    name: Test_Sensor_Down
    state_topic: "stat/TestCov/POWER3"
    payload_on: "ON"
    payload_off: "OFF"

My Scripts:

rf_myroom_cover_down:
    sequence:
      service: mqtt.publish
      data:
        topic: "cmnd/TestCov/POWER3"
        payload: "ON"
  rf_myroom_cover_stop:
    sequence:
      service: mqtt.publish
      data:
        topic: "cmnd/TestCov/POWER2"
        payload: "ON"
  rf_myroom_cover_up:
    sequence:
      service: mqtt.publish
      data:
        topic: "cmnd/TestCov/POWER1"
        payload: "ON"

And this is what i mean with the UI Bar:
Cover

which is from lovelace-vertical-slider-cover-card if someone is interested.

Hi all
I recently bought a curtain wall switch from Amazon (Maxcio RMT005) and I registered it with Tuya. It works well and I’m able to see it in HA as a curtain switch entity, but I don’t have a slider or anything that indicates the cover position (I assume the device doesn’t expose this information). I wanted to use this integration but I’m not sure what to put in the:

open_switch_entity_id:
close_switch_entity_id:

just because I don’t see these entities as the open and close functions are “embedded” in the device itself (not sure I explain this correctly), so I’m kind of stuck here… Either I don’t know what are the right entities to put there or if this integration is suitable for my case.
Thanks everyone !

Congratulations to @robi and @davidramosweb for this wonderful and powerful Custom Component !

My projet (I am very proud of the concept :smiley:) :

  • SOMFY RTS rolling shutters already integrated to Home Assistant with USB RFXTRX433E and the rfxtrx component : only open / close / stop actions with no status return
  • Implement rfxtrx actions in your scripts in order to use your Custom Component to get the possibility to get actions to open or close a chosen fraction of the shutter and get assumed position : please let me know whether this is a dead-end or not.
  • Get rid of the original SOMFY telecommands in order to avoid losing the good prediction of position in Home Assistant
  • Replace them by the rounded Xiaomi Aqara Switches that take long clicks and multi-clicks with automation written in Node-red : one click would mean manual move up to the end, 2 clicks would mean 1/2 move, 3 clicks would mean 1/3 move, and so on, long click would mean toggle move direction (initial move would be defined according to the initial upper or lower position)

I will share here my configuration and scripts if I get through… and my difficulties if not !

I am already back ! I got it through in the first try. Easy and great !

Here it is my configuration file, implementing the original rfxtrx cover device plus typical to the custom component instructions :

rfxtrx:
  device: /dev/ttyUSB1
  devices:
    # cover.bureau     
    071a00000A5D6D01: # Somfy = 071a0000------01
  # If a device ID consists of only numbers, please make sure to surround it with quotes. This is a known limitation in YAML, because the device ID will be interpreted as a number otherwise.

cover:
  - platform: cover_rf_time_based
    devices:
      shutter_bureau:
        name: Volet roulant du bureau
        travelling_time_up: 28
        travelling_time_down: 26
        close_script_entity_id: script.close_shutter_bureau
        stop_script_entity_id: script.stop_or_my_shutter_bureau
        open_script_entity_id: script.open_shutter_bureau
        send_stop_at_ends: False #optional
        aliases:
          - volet_roulant_du_bureau

Here is my scripts file to make it work with rfxtrx cover :

'open_shutter_bureau':
  alias: 'Ouvre le volet du bureau'
  sequence:
    - service: cover.open_cover
      data:
        entity_id: cover.bureau
        #option: open

'close_shutter_bureau':
  alias: 'Ferme le volet du bureau'
  sequence:
    - service: cover.close_cover
      data:
        entity_id: cover.bureau
        #option: closed

'stop_or_my_shutter_bureau':
  alias: 'Fixe le volet du bureau'
  sequence:
    - service: cover.stop_cover
      data:
        entity_id: cover.bureau
        #option: stop

Feel free to share this configuration with RFXTRX in the documentation… or may be too basic… nevertheless I am happy to succeeding in it.

I encountered one conflicting behavior and I found a workaround :

  • SOMFY RTS shutters on Telis radiocommands have a “My” button which is the same button as “Stop” button, that put the shutter in a predefined position when the button is pressed while the shutter is standstill.
  • Such feature leads to the Custom Component losing the shutter position prediction because when “My” action is triggered then CC sees it as just a “stop” and it doesn’t change and know the final position.
  • In the coding here below, someone implemented such a “My position” in its work : YET another time controlled cover (RFLink)
  • For Cover Timed Based to work properly, I simply suppressed the “My” action from the radiocommand by pressing the “My” button during 5 sec.

Finally, happy to see that this even works with Google Assistant : “open shutter at 50%”.

I am feeling grateful to @robi and @davidramosweb developing this piece of code.

Hi, I’m new in HA and the gituhub on the top of this page is what I search since 5 days.
But, I have a little problem, I can’t assign a new cover to a room.

I have tried to add entity_id, delete name and many other but I can’t figure to attribute a room.

Below my code

cover:
  - platform: cover_time_based
    devices:
      persienne_cuisine:
        name: Persienne Cuisine
        travelling_time_down: 23
        travelling_time_up: 25
        open_switch_entity_id: switch.wall_switch_right
        close_switch_entity_id: switch.wall_switch_left
        aliases:
        - persienne_cuisine

  - platform: cover_time_based
    devices:
      persienne_jardin:
        name: Persienne Jardin
        travelling_time_down: 23
        travelling_time_up: 25
        open_switch_entity_id: switch.wall_switch_right
        close_switch_entity_id: switch.wall_switch_left
        aliases:
        - persienne_jardin

  - platform: cover_time_based
    devices:
      persienne_sdb:
        name: Persienne Salle de Bain
        travelling_time_down: 23
        travelling_time_up: 25
        open_switch_entity_id: switch.wall_switch_right
        close_switch_entity_id: switch.wall_switch_left
        aliases:
        - persienne_sdb

homeassistant:
  customize_glob:
    "cover.*":
      optimistic: true
#      position_template: "50"
#      assumed_state: true

I got this and don’t know how to resolve. It’s the last thing to finish my HA configuration.

HA

Thanks for your help.

You should check the home-assistant.log file for any problems. Try removing the aliases part completely, it’s not used anyways.

Thanks for your quick return. But unfortunately that doesn’t change a thing.

I just see that the entity is in read only mode. I think it’s for that but can’t delete this read only mode

I do it by edit the lovelace UI, but If someone have an idea to do it in the configuration file I will try it, just for know.

Thanks

It’s an issue with HA, not the covers component.
Try this:

  • remove completely all your covers from the configuration file
  • restart HA
  • see if you still have the cover entities present as disabled/read-only etc., and try to delete them
  • restart HA again, see if they come back or not. The goal is to clear all covers from the system completely.
  • put them back in the config file (without alias)
  • restart HA, see what’s up.

This is a great custom component…too bad I discovered it after I built my own system of automations to run an automated furnace damper…but yours is better, so thank you and I’m glad I found it!

One thing I ran into is that timed stuff is never perfect - after multiple back and forth movements there is drift in actual versus measured position. I built a zeroing function that drives the damper all the way to one stop (the damper motor is OK with running against the stop for a period of time), and then moves it back to the position the system ‘thought’ it was in.

This would be easy enough to do using the existing component, but might be a useful thing to add as a function (I imagine I’m not the only one to experience this).

Anyway, thanks again!!

On another note, is there a way to set the value of “current_position” using a script, without causing the cover to physically move? Easier than running out the time needed to let the cover get itself there…

Hi Brandon,
It is possible with the trigger-script version of this component, which has the cover_rf_time_based.set_known_position service exactly for this :wink:
If you put a door sensor to the desired end or in the pathway, you can make it jump there every time it passes by it, so you get an auto-calibration each time.

Thanks! I’ll look into that. I don’t think the travel distance is big enough for a door sensor (the contact zone is too wide), but perhaps an optical one or a 3d printer style limit switch would work

Hi,

I am having problem to implment this using rfxcom. I have created a folder under config/cover_rf_time_based but for some reason still got his error.

Logger: homeassistant.components.hassio
Source: components/hassio/init.py:420
Integration: Hass.io (documentation, issues)

Platform error cover.cover_rf_time_based - Integration ‘cover_rf_time_based’ not found.

I suggest to install HACS first to your Home Assistant instance. It will make the management of your custom components a whole lot easier.

Hi,

Thanks manage to solve my problem after install HACS. I am using the rfxcom integration. Next step to figure out how to integrate the state of the blind when someone use an external remote. I do have tasmota rf module as well. May be I should use to update the blind status when someone press the remote. The other simple option is to replace the external remote with opple scene switch (6 buttons)

cover:

  • platform: cover_rf_time_based
    devices:
    blind1_cover_time_based:
    name: Test Blind 1
    travelling_time_up: 68
    travelling_time_down: 68
    close_script_entity_id: script.rf_blind1_down
    stop_script_entity_id: script.rf_blind1_stop
    open_script_entity_id: script.rf_blind1_up
    send_stop_at_ends: False #optional
    aliases:
    - Test Blind 1

‘rf_blind1_down’:
sequence:

  • device_id: b77fdf9bd4a916ca8c96fda9099efba3
    domain: cover
    entity_id: cover.unknown_type_0x19_0x06_010101_16
    type: close
    mode: single

‘rf_blind1_stop’:
sequence:

  • device_id: b77fdf9bd4a916ca8c96fda9099efba3
    domain: cover
    entity_id: cover.unknown_type_0x19_0x06_010101_16
    type: stop
    mode: single

‘rf_blind1_up’:

sequence:

  • device_id: b77fdf9bd4a916ca8c96fda9099efba3
    domain: cover
    entity_id: cover.unknown_type_0x19_0x06_010101_16
    type: open
    mode: single

Hi,

homeassistant:
customize_domain: #for all covers
cover:
device_class: shutter
customize: #for each cover separately
cover.my_test_cover_time_based:
device_class: shutter

How to add a slider to the components so that I can adjust the percentage it open or close

With the latest update from HACS, we respect the changes introduced in XKNX version 0.12.0 where position 0 means “fully open”, 100 means “fully closed”.

After update you need to simply close all your covers from Lovelace to re-sync their position with the reality. From now on 0 means “fully open”, 100 means “fully closed” here too.
This was requested many times and it was impossible until now.