Node-Red and Ikea Blinds (Fyrtur)

Hi all

Have to be honest. Im not a programmer but enjoying hassio and Node-Red anyway.
But my knowledge is limited and deeply depending on the help from forums and more skilled members.

Im trying to get Node-Red working with my Ikea Blinds. The Ikea app is not very usefull when automation other than timing the blinds is needed.

My end goal is to get the blinds to function when certain circumstances occur. If the sun is shining, the time is past 2 pm and the tv is turned on the blinds should roll down. But im a long way from that.

I wish to use Node-Red to do the automation and its working when using the “Cover” domain and the service “close_cover” or “open_cover”. That way they can go up and down. But I really like to use a specific position depending with the service “set_cover_position” and cant get that to work at all. Probably because I dont know to command it the right way.

Anyone who can help me with the “almost” first step? Hope so and thanks in advance!

it’s expecting something in the data field as mentioned in the explanation. something like this: {"position":30}

Do you have an idea on how this is possible to test. Have tried with data when injecting the command but without luck :roll_eyes: but really don’t know what I’m doing.

i don’t have covers so not sure the exact setup but are you able to make it work in home assistant? what does it look like when you do a service call in developer tools.

I am, they work like a charm in home assistent. And your really helping me here, because they actually do what they are told when trying in developer tools.

When calling the service “cover.set_cover_position” with the parameters
entity_id: cover.blind_north
position: 30

the specified blinds move to position 30. Nows the question how to do the same in Node Red :slight_smile:

In that case, on the first image you supplied.
To the right of the cursor there is three dots on the data line.
Click there.

Input:

{
    "entity_id": "cover.blind_north",
    "position": 30
}

As you can see yaml and json are very similar.
Json just have more characters.
They open and close with {} and each key and value pair is enclosed in “” unless it’s a number.

1 Like

The rules and syntaxes make it so difficult for me who does not have much programming experience. Makes me think about how to get it without going on a course for a few years :slight_smile:
It works in Node Red so Im very happy. And I really appreciate the help from both of you, because you have pushed me forward in a positive direction.
One thing which is maybe obvious. Is it possible to “inject” the input from a node like “inject” or “bigtimer”? Otherwise I will use multiple “call service” which is no problem, but I guess there is a smarter way of doing it :slight_smile:

There is no better way that I can think of.
You could possibly use a function node and use JavaScript to iterate an array of blinds, but since you are not a programmer then that is probably out of question.
And even though I do program I would not use that method anyways.
There is a benefit of seeing it all at once. Every time you hide stuff in function nodes it get slightly harder to read the flow.

You are right. keep it as simple as possible makes it easier to understand when looking into it again after a year or so. And yes, I wouldn’t dare to do any javascripting :slight_smile:

what do you want to inject? the position or the entity?

I guess it should be the position. That way I could have only one node for setting a random position.

So you mean you have a input number or slider that and that number is what the position should go to when the flow runs?

Yes exactly. The idea is when the sun is in a certain position go til position x, when sun moving go to position y and so on.

But this actually is working and no problem to work further on at all :slight_smile:

Edit: I see your edit now.
That isn’t so bad. Since it’s different blinds it would probably be hard to get any more compact anyways

Ok…
In that case either you put a get state node and get the current position of the sun in your flow.
Then add a switch node to switch in between it all.

The fancy solution is to use the get state then a function node, but I guess you will need help with that.
If you just tell us a few positions say some morning setting, some mid-day and something later at night then either me or someone else can give you the base and you can probably see whst you need to do to file out the rest.

@Hellis81 Hello, How exactly do I have to parameterise the action node in node-red if I want to move the roller blind to a certain position?

Like this?

This ist the Data:
image

Above all, I would like to specify the ‘position’ variable via a msg.payload, for example. What does it look like then?

Many thanks :slight_smile:

It was a long time ago since I used node red.
If I remember correctly, remove 30 and write msg.payload

ok, but the content of the JSON structure in Data is correct?

I believe so.
I don’t have any covers.

1 Like

You shouldn’t need to enter the entity_id in the data, just the position.

{
  "position": 30
}

To send it in via payload

{
  "position": payload
}

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/cookbook/jsonata/action.html