Home Assistant Community

Control RF Blinds by percentage (%) Node Red or HomeKit

configuration
homekit
Tags: #<Tag:0x00007fcf4f3d6398> #<Tag:0x00007fcf4f3d5ad8>
#1

Hi
I have a smart RF Controlled blind/curtain
That has 3 options

Open
Close
And pause

I use the Broadlink RM Pro
To control it
And it works fine

I’ve even got it working with HomeKit
Via setting every button as a script and putting those scripts as a curtain component in HA/thus it appears as curtain in HomeKit

The problem is though… that I have no percentage control over it
Like I can’t set it to close to 10% etc …

I’d like a way to do so
In HomeKit
Or even Node-RED (Alexa) like to say
Alexa set the curtains to 30%

Dose anyone have an Idea on how to do so ??

#2

I’v never had remote controlled blinds (yet) but as i do with my fans to control them in alexa i use template lights in ha, their execution script don’t do anything in ha, their brightness state is proportional to the fan speed state.

So basically the light appears in alexa with name “masterbedroom fan”, then it gets called say to set it to 50%, then in node red i can catch the service call with the requested brightness, so then i pass the a call service to the fan entity in ha transforming the pct brightness into a similar speed.

My guess is that if you want to do this with blinds you will have to time the closing and opening times so you can have an estimate of how much time it takes to move the whole blind down. Just an idea

#3

You can use a custom component.

You can get the version from here: Template Cover

#4

I use the template cover switch to do this
But with rather HomeKit it works fine

But … the problem is It doesn’t set to specific percentages

It just has the on / off / pause commands
(That are the default on the remote)

The pause button is set as 50%
So if you set the blind in HomeKit to 50% it pause
(It doesn’t actually set it to 50%)
It just hits pause

I want a way to make it so when I say for example set to 30% it sets it to 30% not just pause

Do you get what I’m aiming at ?

#5

I do this with my outdoor shades.

#6

Can you explain what’s happening in NODE-RED or upload the flow so I can try to understand what’s happening

#7

And I’d really would like to know how you control the position of the shades

This is a picture of my remote

As you can see I only have 3 buttons

And I have some main goals I want to acomplish

1 - Control the shades by percentage (Like Alex (a , set shades to 10%)
2 - I want the changing to be seemless , meaning that I don’t the shade reset every time it changes position (Like if it’s in 10% then I ask alexa to change it and it goes back to 0% then goes to the desired position
I want it to directly go from 10 to 20% for example.

#8

Just use the template cover I have provided the link for. No need for node red. It just does what you asked for. The main difference is that there are two more parameters in the custom component one for opening time and one for closing time. With these two values you can set the covers to any percentage. The component calculates the time needed to get from one to another.

#9

Hey I am sorry I didn’t try your method
I thought it involved using google assistant which I don’t have

I will try it
But Can you specify where do I put the file and what should I name it ??

#10

Do you have a picture of what you component looks like on the GUI when implemented? How do you hook it up to Alexa?

#11

It is just a normal cover component where the position slider does actually work. I don’t have alexa enabled so I can’t guide on that aspect. But after configuring the cover it should be easy. Currently I use the cover in homekit and google assistant where both are able to set any percentage.

image

You add the file to:
/home/pi/.homeassistant/custom_components/timedcover/cover.py

timedcover is the name i made up, you can change it to whatever you want.The only requirement is that it should be unique.
for the configuration.yaml you add this:

cover:
  - platform: timedcover
    covers:
      study_right_cover:
        friendly_name: 'Study Right Cover'
        open_cover:
          service: switch.turn_on
          entity_id: switch.study_right_cover_on
        close_cover:
          service: switch.turn_off
          entity_id: switch.study_right_cover_on 
          #I've set the switch so that the on position refers to up in the remote and the off position refers to down on remote
        stop_cover:
          service: switch.turn_on
          entity_id: switch.study_right_cover_stop             
        opening_time: 45
        closing_time: 45
        tilt_optimistic: false #didn't manage to get rid of tilt which does not work.

For the cover I have a dooya motor which works on 433MHz, which I had configured from broadlink. You can assign any switch you want which turns the cover on, off and stop.

Also don’t forget that the percentage is handled by a timer. So if you set the position to %50 you should at least wait for 22.5 seconds until you give a second percentage command. Otherwise it will lose the synchronization. If you do lose the synchronization you can set the cover to the limits where the current position on the ui and the real cover will be same.

#12

Ok I see. I think I’ll just stick with NodeRed. It pretty much does the same thing. I have a time for close and open defined and just run percentages of that.
I have a lot of other flows integrated into it, so makes more sense for me just to keep everything there. I have 3 different shades that I either operate independently or together and my flows are coordinated if you start changing from all to a single or visa versa. Wind monitoring and time of day etc.
had I known there was a custom component I would’ve probably gone that way initially.
Why not try and get it implemented natively?

#13

The component, which was not done by me, has been around for a while now. I also would like to see it as a native component :slight_smile:

#14

@sendorm thanks works like a charm
@AZDane I’ll maybe try your method when I start the Alexa integrations but now I’m sticking with HomeKit

#15

Glad it worked for you too.

#16

Any chance you are able to upload your nodered flow so we can import it?

#17

Here is the Node Red Flow for the shades:

Here the flow for the Wind Warning:

If you look at my picture above you will see two green lines. One above representing steady wind and one below gusts. They turn red i too high. Alexa will give a warning if I lower the shades when its too windy and will give a warning if the wind picks up while the shades are down.

Here is my UI code:

- cards:
      - card:
          hold_action:
            action: none
          image: /local/Red.jpg
          tap_action:
            action: none
          type: picture
        conditions:
          - entity: input_boolean.shade_too_windy
            state: 'on'
        type: conditional
      - card:
          hold_action:
            action: none
          image: /local/Green.jpg
          tap_action:
            action: none
          type: picture
        conditions:
          - entity: input_boolean.shade_too_windy
            state: 'off'
        type: conditional
      - entities:
          - entity: cover.kitchen_shade
          - entity: cover.side_shade
          - entity: cover.patio_shade
          - entity: cover.all_shades
        show_header_toggle: false
        title: Shades
        type: entities
      - card:
          hold_action:
            action: none
          image: /local/Red.jpg
          tap_action:
            action: none
          type: picture
        conditions:
          - entity: input_boolean.shade_too_windy_gust
            state: 'on'
        type: conditional
      - card:
          hold_action:
            action: none
          image: /local/Green.jpg
          tap_action:
            action: none
          type: picture
        conditions:
          - entity: input_boolean.shade_too_windy_gust
            state: 'off'
        type: conditional
    type: vertical-stack
#18

Edit: I worked it out. Just needed to add an init file

This has been working perfectly for me but since moving over to 0.92.2 it has stopped working. I assume this is related to the changes that have been made for integrations (creating_integration_file_structure).

Have you moved up to 0.92.2? I’m not familiar with programming let alone python and wouldn’t know where to start getting this working with the new integration stuff, any help would be appreciated.

1 Like
#19

I am on the same train. I moved back to 0.89.2 until someone comes out with a easy to follow explanation to sort this out. I think that someone is you :slight_smile: Will give it a try when i find the time. Thank you.

Of course the hanging of HASS when a camera disconnects should also be fixed before i try. I think that should also be fixed in upcoming releases.

#20

Not experienced that issue yet with camera’s. Guess it’s always good to wait a while before upgrading.

I added two files under the timedcover folder, just looked at another custom component and copied roughly what they had. Working fine now.

  1. init.py

    “”“The timedcover component.”""

  2. manifest.json

    {
    “domain”: “timedcover”,
    “name”: “Timed Cover”,
    “documentation”: “https://github.com”,
    “requirements”: [],
    “dependencies”: [],
    “codeowners”: [“s”]
    }

1 Like