Custom Component: Cover Time Based

Thanks for the component. It’s working great. One question, is it possible to invert the slider?
Right now, 0 means closed and 100 means open.
I would like to have it the other way around (0 = open, 100 = closed).

This has been asked many times. It is not possible because in the core of Home Assistant all covers are 0 closed and 100 open. It does not depend on the component.

Hi there, thanks for being part of the awesome developer community for HomeAssistant… I’ve got a slightly different setup, in that I’m using shades controlled via the Somfy Mylink, which - while it handles “go up” and “go down” commands just fine via the HA integration, does not provide any positioning data. Is there a way your integration can call the cover.open_cover, cover.close_cover, and cover.stop services rather than using custom scripts, and return a confident current position based on a door/window sensor status? (Or, asked another way, can this work if I don’t use a Sonoff or other RF bridge to send the open/close signals to the bliinds). Thanks for your help!

That depends on how Somfy Mylink works, unfortunately I’ve got no info about that.

@davidramosweb, EXCELLENT component. I was looking for something like this for some time. Helps a lot for all my somfy IO components which I don’t have the expensive genuine IO integration for them, but control them via a wemos d1 with Tasmota and directly connected I/O pins to the button contacts.
But it was only possible to completely open/close the roller shutters. UNTIL NOW :slight_smile:

My question: Do you plan to add the component to HACS? This would make it more popular as it’s easier to find & install for more people.

Thanks!

The RF version is there.

All I need to be able to do is call the open/close/stop service instead of calling a script…

You’re in luck then because all you need is to call the open/close/stop service from the script.

As it’s been discussed earlier, the requirement for scripts is because there exist hundreds of cover systems on the market and each works in a different way, with scripts you get flexibility to integrate them regardless of cover type. Most of them cannot be commanded with service calls as they don’t have native integrations with HA… Many need multiple service calls per command etc…

So I’m not sure if I’m misunderstanding but I’m using the aliases statement to force the device name - but it seems to be ignored: my definition is:

  - platform: cover_rf_time_based
    devices:
       office_blind:
         name: 'Office blind'
         travelling_time_up: 20
         travelling_time_down: 20
         close_script_entity_id: script.1584955489914
         stop_script_entity_id: script.1584956945173
         open_script_entity_id: script.1584955561767
         send_stop_at_ends: False
         aliases: 
           - officeb

I expect the device to end up being called cover.officeb but it seems to be creating it based on the name…

Hi!

I’m trying to use this custom component (the RF version I’m using scripts with my Smart Life smart shutters so that I can send specific commands).

However I’m kinda bugged since I don’t want the position, all I want is to add a timer to the switches so that when it stops, it launches the stop command. I was trying to check the cover.py in order to adapt it but since you use the travel in order to launch either command, I’m kinda lost (especially since I can’t seem to find where you use the timers, other than try to calculate the position depending of the time spent and time remaining).

Any help is greatly appreciated!

Thanks again!

All you have to do is to add the stop command in your script stop_script_entity_id: script.rf_myroom_cover_stop

Hi, thanks for the reply.

However your solution doesn’t work. Maybe I didn’t really described correctly what I want to do :slight_smile:
Let’s imagine that when I turn on the server my covers are closed but the server thinks they are open. I can’t open them through HA since the travel will crap out. Indeed why open something that is already open?

In order to remove this issue, all I wanted to do is remove this travel calculation in order to only use the timers and launch a stop at the end of the timer. I won’t have the position or the status of the cover but that doesn’t bother me since I can’t even have this info from smartlife.

Since you are using xknx devices, maybe there was a thing in there that can give us this info, or maybe change the stop if necessary and change to if time stop then stop or something (I’m new to all this HA coding stuff).

There should be a mechanical/electrical protection in the cover to prevent this.

There will be lots of times when the covers and their state in HA will be out of sync because many reasons can happen, you should handle this in a different way. Yes, send an open command and the cover should be prepared not to execute it if’s already opened. There’s a send_stop_at_ends parameter just for this.

Your solution kinda works. It does indeed continue even if the travel is out of sync so that’s a good point. However the timer isn’t taken into account, I can set it to 5, 10, or 50 it doesn’t stop. My idea was to take only the timer and make the open / close during that period of time and stop it if reaches 0.

Sure there is a protection inside but I would like to automatically make it stop instead of waiting for the protection (which is like 90 seconds after i gave the command) to trip in. May not seem to gain much since I only gain like 40sec of read light on my different covers but it’s better than nothing :smiley: Otherwise the standard cover of HA works just fine since the timer isn’t taken into account.

Well, you’re better with the standard cover then, or maybe you could try timedcover, code is easier to modify.

I’m a real newby to HA. First thank you so much, i got everything running with the basics :slight_smile:

Now I am a little Stuck. I want HA to recognize if i push the buttons outside of HA for my cover. I think the solution should be cover_rf_time_based.set_known_action. The only way i can recognize actions of my cover is by MQTT listening so far.
E.g. if i push outside of HA the button up i can listen over MQTT to: cmnd/TestCov/POWER1 changing to “ON”

I don’t understand how to implement that into the services (and where). I want them to listen all the time on MQTT and change the bar if i press Up = Power1 / Stop = Power2 / Down = Power3.

Can someone help me?

Hi and welcome.
It’s fairly easy, it’s in the example. You should set up MQTT binary sensors for your buttons outside HA, and then according to the example create little automations for each, to trigger the set_known_action service.

And here is my fork, modified for KNX covers: download from GitHub

See how it works on GitHub, but the main idea is that you need to add KNX group addresses to open/close the cover, but also group addresses to allow Home-Assistant to watch your KNX bus and know when your cover is triggered by a real switch for exemple !

Example configuration.yaml entry

There are some other settings to do, so please check the GitHub repo

cover:
  - platform: cover_knx_time_based
    devices:
      my_room_cover_time_based:
        name: "My Room Cover"
        travelling_time_up: 36
        travelling_time_down: 34
        move_group_address: "2/4/0"
        stop_group_address: "2/4/1"
        watch_move_group_addresses:
          - "2/4/0"
          - "24/4/23"
          - "10/4/226"
          - "24/4/45"
        watch_stop_group_addresses:
          - "2/4/1"
          - "24/4/24"
          - "10/4/225"
          - "24/4/46"
        send_stop_at_ends: False #optional
        aliases: #optional
          - my_room_cover_time_based

Thanks a lot to Robert and David for their work which made this possible !

Wow! That’s great!

@CharlieBailly Why is this needed for knx? The integration supports time based cover positions per default, doesnt it?