[NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Moderator: leecollings

User avatar
FireWizard
Posts: 1771
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by FireWizard »

@hoeby

HI,

Thanks for a lot of information .

But if I understand it well, the only value you want to send to Domoticz is the position, as at the end it will always indicate the correct position.

Do you want to indicate the POWER1 and POWER2? And if, how?

Regards
hoeby
Posts: 530
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by hoeby »

The value of "Position" is the value i want to sync with domoticz
I don't want to know the state of Power1 and Power2.
But i use it in my flow to disable the domoticz mqtt messages.
When PowerX = "ON" then domoticz mqtt messages are disabled to go to the idx<->shelly.
When PowerX = "OFF" then domoticz mqtt messages are enabled. When receiving the OFF command there is a delay of 3 seconds, before the domoticz mqtt messages are allowed. This to prevent a busy system, that a message will come after 1 second. When testing i noticed that sometime a message has a delay before it goes tru Node-red.


I tested your flow.

When i push the inject, than it works.

But when disconnection the inject from the function and connect the shelly/in.
Than i get this error. It is comming from the function-component.
The output however works and is handeled by domoticz

Code: Select all

TypeError: Cannot read property 'Position' of undefined
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
User avatar
FireWizard
Posts: 1771
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by FireWizard »

@hoeby
I don't want to know the state of Power1 and Power2.
But i use it in my flow to disable the domoticz mqtt messages.
When PowerX = "ON" then domoticz mqtt messages are disabled to go to the idx<->shelly.
When PowerX = "OFF" then domoticz mqtt messages are enabled. When receiving the OFF command there is a delay of 3 seconds, before the domoticz mqtt messages are allowed. This to prevent a busy system, that a message will come after 1 second. When testing i noticed that sometime a message has a delay before it goes thru Node-red.

We can use that as well. We see later.

When i push the inject, than it works.
But when disconnection the inject from the function and connect the shelly/in.
Than i get this error. It is coming from the function-component.
The output however works and is handled by domoticz
In the MQTT node, called Shelly Out - MQTT In, did you set "Output" to " a parsed JSON object" ?

If not, change it. And Otherwise send the output of the debug node, connected to the MQTT node, called Shelly Out - MQTT In.

Regards
hoeby
Posts: 530
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by hoeby »

FireWizard wrote: Sunday 31 May 2020 21:01 In the MQTT node, called Shelly Out - MQTT In, did you set "Output" to " a parsed JSON object" ?
It was by default in your flow as "a parsed JSON object"
FireWizard wrote: Sunday 31 May 2020 21:01 If not, change it. And Otherwise send the output of the debug node, connected to the MQTT node, called Shelly Out - MQTT In.
The debug output

31-5-2020 21:35:55node: Prrepare To Domoticz
function : (error)
"TypeError: Cannot read property 'Position' of undefined"

31-5-2020 21:35:55node: 1b719fe2.cfc22
stat/DZ_SH_A/RESULT : msg.payload : Object
{ POWER2: "ON" }

31-5-2020 21:35:55node: 1b719fe2.cfc22
stat/DZ_SH_A/RESULT : msg.payload : Object
object
Shutter1: object
Position: 100
Direction: -1
Target: 0

31-5-2020 21:35:55node: 1b719fe2.cfc22
stat/DZ_SH_A/RESULT : msg.payload : Object
object
Shutter1: object
Position: 100
Direction: -1
Target: 0

31-5-2020 21:35:55node: Prrepare To Domoticz
function : (error)
"TypeError: Cannot read property 'Position' of undefined"

31-5-2020 21:35:55node: 1b719fe2.cfc22
stat/DZ_SH_A/RESULT : msg.payload : Object
{ POWER2: "OFF" }

31-5-2020 21:35:55node: 1b719fe2.cfc22
stat/DZ_SH_A/RESULT : msg.payload : Object
object
Shutter1: object
Position: 99
Direction: 0
Target: 100


Also found something with my complex flow. That it is not dummy proof.
It still works. Only when it doesn't work: When you manually move the shutter, but noticed you went to wrong way and changing the manual control to the opposite direction, than the loop comes in. Because you switch from ON to OFF. The OFF is delayed for 3 seconds. But in this delay you already send a new ON from the opposite direction. The OFF comes after this and opens the domoticz/out mqtt
Last edited by hoeby on Sunday 31 May 2020 21:54, edited 1 time in total.
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
User avatar
FireWizard
Posts: 1771
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by FireWizard »

Hi
@hoeby

What do you see when you hoover with your mouse over the path icon right of position in the debug node?
Copy it in an editor.

Screenshot_Shelly1.png
Screenshot_Shelly1.png (22.69 KiB) Viewed 2209 times
What you get of the Shelly should be similar to this picture.

Regards
hoeby
Posts: 530
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by hoeby »

When i hover over it and copy it, then is see this.
For the fun i removed the path in the function and paste the copied part there. To be sure no typo was made.
Made no difference

Code: Select all

payload.Shutter1.Position
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
User avatar
FireWizard
Posts: 1771
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by FireWizard »

@hoeby,

I have a feeling.

Please try this flow instead.

Code: Select all

[{"id":"43365171.f71f78","type":"mqtt in","z":"56f1881a.2a6b9","name":"Shelly Out - MQTT In","topic":"stat/DZ_SH_A/RESULT","qos":"2","datatype":"json","broker":"c2d9657a.d81bf8","x":200,"y":160,"wires":[["1b0f86a2.453061"]]},{"id":"eb91d261.f985a8","type":"inject","z":"56f1881a.2a6b9","name":"Simulate Shelly Out","topic":"stat/DZ_SH_A/RESULT","payload":"{\"Shutter1\":{\"Position\":44,\"Direction\":1,\"Target\":56}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":100,"wires":[["1b0f86a2.453061","d7b04b8a.069148"]]},{"id":"1b0f86a2.453061","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":430,"y":160,"wires":[]},{"id":"b5bbfdaa.73ddc8","type":"function","z":"56f1881a.2a6b9","name":"Prepare To Domoticz","func":"msg.payload = {\"command\":\"switchlight\",\"idx\":18,\"switchcmd\":\"Set Level\",\"level\":msg.payload.Shutter1.Position}\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":80,"wires":[["b1b8faa8.f974b8","930034c0.0bb858"]]},{"id":"b1b8faa8.f974b8","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":850,"y":40,"wires":[]},{"id":"930034c0.0bb858","type":"mqtt out","z":"56f1881a.2a6b9","name":"Domoticz In","topic":"domoticz/in","qos":"","retain":"","broker":"c2d9657a.d81bf8","x":850,"y":80,"wires":[]},{"id":"d7b04b8a.069148","type":"switch","z":"56f1881a.2a6b9","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"payload.Shutter1","vt":"jsonata"},{"t":"cont","v":"payload.ShutterPosition1","vt":"jsonata"},{"t":"cont","v":"payload.POWER1","vt":"str"},{"t":"cont","v":"payload.POWER2","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":410,"y":100,"wires":[["b5bbfdaa.73ddc8"],[],[],[]]},{"id":"c2d9657a.d81bf8","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Let me know.
hoeby
Posts: 530
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by hoeby »

That one works.

If i got it right.
The error came because there are Multi messages send. But not all contain the position value and therefor the error occurred?

Now to stept 2? Where are going to get the otherway around working.
This is the domoticz mqtt messages, which domotcz sends.

Code: Select all

{   "Battery" : 255,   "RSSI" : 12,   "description" : "",   "dtype" : "Light/Switch",   "id" : "000140BD",   "idx" : 109,   "name" : "DH_SH_A",   "nvalue" : 2,   "stype" : "Switch",   "svalue1" : "66",   "switchType" : "Blinds Percentage",   "unit" : 1}
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
hoeby
Posts: 530
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by hoeby »

Tried to made the flow from domoticz to shelly.
Have a look

Code: Select all

[{"id":"9a47c26c.9dd2c","type":"inject","z":"42785913.d8fe38","name":"Simulate Domoticz Out","topic":"domoticz.out","payload":"{   \"Battery\" : 255,   \"RSSI\" : 12,   \"description\" : \"\",   \"dtype\" : \"Light/Switch\",   \"id\" : \"000140BD\",   \"idx\" : 109,   \"name\" : \"DZ_SH_A\",   \"nvalue\" : 2,   \"stype\" : \"Switch\",   \"svalue1\" : \"66\",   \"switchType\" : \"Blinds Percentage\",   \"unit\" : 1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":264.2857360839844,"y":455.71429443359375,"wires":[["c4ba363.e9bbec8","7294110f.6d2d1"]]}]
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
User avatar
FireWizard
Posts: 1771
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by FireWizard »

Good morning

@hoeby
If i got it right.
The error came because there are Multi messages send. But not all contain the position value and therefor the error occurred?
You are right. That is why I made the split to different outputs. However the switch node is not correctly configured yet.
You can test that by connecting a Debug node to the 4th output of the switch node, I expect that you don't see anything.
I have to look into that.
Now to step 2? Where are going to get the other way around working.
This is the domoticz mqtt messages, which domoticz sends.
The position of the slider is in the svalue.
If you move the slider, the svalue may change.

You can test it with the following flow:

Code: Select all

[{"id":"fcc52c89.40fcb8","type":"mqtt in","z":"56f1881a.2a6b9","name":"Domoticz Out","topic":"domoticz/out","qos":"2","datatype":"json","broker":"c2d9657a.d81bf8","x":170,"y":340,"wires":[["333a575f.6d0128"]]},{"id":"333a575f.6d0128","type":"switch","z":"56f1881a.2a6b9","name":"Filter Shutter Switch","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"18","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":400,"y":340,"wires":[["2c8bdab8.88c546"]]},{"id":"2c8bdab8.88c546","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":690,"y":340,"wires":[]},{"id":"c2d9657a.d81bf8","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
You have to change "Filter Shutter Switch" the IDX 18 to your IDX (109)

The question now is: What do I have to send to the Shelly, in order to change the position?
Is that {"ShutterPosition1":19}
Tried to made the flow from domoticz to shelly.
Have a look
This is only an Inject node that represents the output from Domoticz.
We have that already. So we can skip this.

Regards
hoeby
Posts: 530
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by hoeby »

This is what i send to shelly

Topic: cmnd/DZ_SH_A/ShutterPosition
Payload = svalue1

Your flow, i will check
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
User avatar
FireWizard
Posts: 1771
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by FireWizard »

Hi,

@hoeby

I have changed the flow a little, as I have decided to split the messages between Shutter1, Shutterposition, POWER1 and POWER2 directly after the MQTT input node, before doing any further processing.

As I'm not 100% that a sequence of 4 messages are sent, I created a 5th output, where all other messages are captured.
I have connected Debug nodes and please check if the messages are going to the correct output, if you connect the MQTT input node.

Do not forget to change the IDX in the Function node.

Please test the following flow:

Code: Select all

[{"id":"af972d40.75509","type":"mqtt in","z":"56f1881a.2a6b9","name":"Shelly Out - MQTT In","topic":"stat/DZ_SH_A/RESULT","qos":"2","datatype":"auto","broker":"c2d9657a.d81bf8","x":200,"y":200,"wires":[["4936cdd.1c8c034"]]},{"id":"a331717e.bffac","type":"inject","z":"56f1881a.2a6b9","name":"Simulate Shelly Out","topic":"stat/DZ_SH_A/RESULT","payload":"{\"Shutter1\":{\"Position\":64,\"Direction\":0,\"Target\":64}}","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":160,"wires":[["4936cdd.1c8c034"]]},{"id":"efd8ce75.fcd368","type":"function","z":"56f1881a.2a6b9","name":"Prepare To Domoticz","func":"msg.payload = {\"command\":\"switchlight\",\"idx\":18,\"switchcmd\":\"Set Level\",\"level\":msg.payload.Shutter1.Position}\nreturn msg;","outputs":1,"noerr":0,"x":780,"y":140,"wires":[["79ded80.70563a8","cb5324b1.83c65"]]},{"id":"79ded80.70563a8","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1010,"y":100,"wires":[]},{"id":"cb5324b1.83c65","type":"mqtt out","z":"56f1881a.2a6b9","name":"Domoticz In","topic":"domoticz/in","qos":"","retain":"","broker":"c2d9657a.d81bf8","x":1010,"y":140,"wires":[]},{"id":"4936cdd.1c8c034","type":"switch","z":"56f1881a.2a6b9","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"Shutter1","vt":"str"},{"t":"cont","v":"ShutterPosition1","vt":"str"},{"t":"cont","v":"POWER1","vt":"str"},{"t":"cont","v":"POWER2","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":5,"x":410,"y":140,"wires":[["11a8b3a6.bd921c","797d5ce8.065f5c"],["27477d7b.6dd8da"],["71ebf67c.496d68"],["3371904c.cebc6"],[]]},{"id":"91a92a37.bb5a18","type":"inject","z":"56f1881a.2a6b9","name":"Power 2 ON","topic":"stat/DZ_SH_A/RESULT","payload":"{\"POWER2\":\"ON\"}","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":80,"wires":[["4936cdd.1c8c034"]]},{"id":"deb751b8.b95878","type":"inject","z":"56f1881a.2a6b9","name":"POWER 2 OFF","topic":"stat/DZ_SH_A/RESULT","payload":"{\"POWER2\":\"OFF\"}","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":120,"wires":[["4936cdd.1c8c034"]]},{"id":"3371904c.cebc6","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":259,"wires":[]},{"id":"11a8b3a6.bd921c","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":100,"wires":[]},{"id":"797d5ce8.065f5c","type":"json","z":"56f1881a.2a6b9","name":"","property":"payload","action":"","pretty":false,"x":570,"y":140,"wires":[["efd8ce75.fcd368","754432cb.b67bb4"]]},{"id":"754432cb.b67bb4","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":790,"y":100,"wires":[]},{"id":"71ebf67c.496d68","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":219,"wires":[]},{"id":"27477d7b.6dd8da","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":180,"wires":[]},{"id":"c2d9657a.d81bf8","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
If everything is working fine, you can delete the various debug nodes.

And then:
This is what i send to shelly

Topic: cmnd/DZ_SH_A/ShutterPosition
Payload = svalue1
The svalue1 represents the shutterposition, but how is this send to Shelly?

I have to look into it.

Regards
hoeby
Posts: 530
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by hoeby »

When i send this to mqtt, then the shelly. Then it goes to percentage 66%
where cmnd/DZ_SH_A/ShutterPosition is the topic
and the 66 is the payload

Code: Select all

cmnd/DZ_SH_A/ShutterPosition 66
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
hoeby
Posts: 530
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by hoeby »

FireWizard wrote: Monday 01 June 2020 11:53 The position of the slider is in the svalue.
If you move the slider, the svalue may change.

You can test it with the following flow:

Code: Select all

[{"id":"fcc52c89.40fcb8","type":"mqtt in","z":"56f1881a.2a6b9","name":"Domoticz Out","topic":"domoticz/out","qos":"2","datatype":"json","broker":"c2d9657a.d81bf8","x":170,"y":340,"wires":[["333a575f.6d0128"]]},{"id":"333a575f.6d0128","type":"switch","z":"56f1881a.2a6b9","name":"Filter Shutter Switch","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"18","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":400,"y":340,"wires":[["2c8bdab8.88c546"]]},{"id":"2c8bdab8.88c546","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":690,"y":340,"wires":[]},{"id":"c2d9657a.d81bf8","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
This works. This is the message from IDX 109 (18 in your case)
1-6-2020 16:44:11node: 23997222.d2663e
domoticz/out : msg.payload : Object
object
Battery: 255
RSSI: 12
description: ""
dtype: "Light/Switch"
id: "000140BD"
idx: 109
name: "DZ_SH_A"
nvalue: 2
stype: "Switch"
svalue1: "75"
switchType: "Blinds Percentage"
unit: 1
FireWizard wrote: Monday 01 June 2020 11:53 This is only an Inject node that represents the output from Domoticz.
We have that already. So we can skip this.
Something went wrong with the export.
This is my flow with all components. Tested this one, this one works for sending domoticz state to shelly tasmota
I think it only needs a filter, that not all mqtt messages are changed to tasmota mqtt and send.

Code: Select all

[{"id":"42785913.d8fe38","type":"tab","label":"Flow 2","disabled":true,"info":""},{"id":"5d0cc7a3.d68fa8","type":"mqtt in","z":"42785913.d8fe38","name":"Shelly Out - MQTT In","topic":"stat/DZ_SH_A/RESULT","qos":"2","datatype":"json","broker":"74d9fea2.8d044","x":258.5714416503906,"y":308.5714111328125,"wires":[[]]},{"id":"8f330065.ac171","type":"inject","z":"42785913.d8fe38","name":"Simulate Shelly Out","topic":"stat/DZ_SH_A/RESULT","payload":"{\"Shutter1\":{\"Position\":44,\"Direction\":1,\"Target\":56}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":248.57144165039062,"y":248.5714111328125,"wires":[["808a3904.e73548","2932ad1.8c60152"]]},{"id":"808a3904.e73548","type":"debug","z":"42785913.d8fe38","name":"simulate shelly out","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":508.5714416503906,"y":308.5714111328125,"wires":[]},{"id":"c09c5472.b2f218","type":"function","z":"42785913.d8fe38","name":"Prepare To Domoticz","func":"msg.payload = {\"command\":\"switchlight\",\"idx\":109,\"switchcmd\":\"Set Level\",\"level\":msg.payload.Shutter1.Position}\nreturn msg;","outputs":1,"noerr":0,"x":678.5714416503906,"y":228.5714111328125,"wires":[["c221f4f6.03b358","4ca2f838.af40a8"]]},{"id":"c221f4f6.03b358","type":"debug","z":"42785913.d8fe38","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":908.5714416503906,"y":188.5714111328125,"wires":[]},{"id":"4ca2f838.af40a8","type":"mqtt out","z":"42785913.d8fe38","name":"Domoticz In","topic":"domoticz/in","qos":"","retain":"","broker":"74d9fea2.8d044","x":908.5714416503906,"y":228.5714111328125,"wires":[]},{"id":"2932ad1.8c60152","type":"switch","z":"42785913.d8fe38","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"payload.Shutter1","vt":"jsonata"},{"t":"cont","v":"payload.ShutterPosition1","vt":"jsonata"},{"t":"cont","v":"payload.POWER1","vt":"str"},{"t":"cont","v":"payload.POWER2","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":468.5714416503906,"y":248.5714111328125,"wires":[["c09c5472.b2f218"],[],[],[]]},{"id":"8bde8354.a558a","type":"mqtt in","z":"42785913.d8fe38","name":"Domoticz Out - MQTT In","topic":"domoticz/out","qos":"2","datatype":"json","broker":"74d9fea2.8d044","x":274.2857360839844,"y":515.7142944335937,"wires":[[]]},{"id":"9a47c26c.9dd2c","type":"inject","z":"42785913.d8fe38","name":"Simulate Domoticz Out","topic":"domoticz.out","payload":"{   \"Battery\" : 255,   \"RSSI\" : 12,   \"description\" : \"\",   \"dtype\" : \"Light/Switch\",   \"id\" : \"000140BD\",   \"idx\" : 109,   \"name\" : \"DZ_SH_A\",   \"nvalue\" : 2,   \"stype\" : \"Switch\",   \"svalue1\" : \"66\",   \"switchType\" : \"Blinds Percentage\",   \"unit\" : 1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":264.2857360839844,"y":455.71429443359375,"wires":[["c4ba363.e9bbec8","7294110f.6d2d1"]]},{"id":"dd85752f.0bcce8","type":"debug","z":"42785913.d8fe38","name":"simulate domotiz out","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":524.2857360839844,"y":515.7142944335937,"wires":[]},{"id":"c4ba363.e9bbec8","type":"function","z":"42785913.d8fe38","name":"Prepare To shelly","func":"msg.topic = \"cmnd/\" + msg.payload.name + \"/shutterPosition\";\nmsg.payload = msg.payload.svalue1;\nreturn msg;\n\n","outputs":1,"noerr":0,"x":528.5716857910156,"y":457.1428527832031,"wires":[["7294110f.6d2d1","b365e775.adb808"]]},{"id":"7294110f.6d2d1","type":"debug","z":"42785913.d8fe38","name":"prepare shelly ","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":907.1429443359375,"y":458.5715026855469,"wires":[]},{"id":"b365e775.adb808","type":"mqtt out","z":"42785913.d8fe38","name":"Shelly In","topic":"","qos":"","retain":"","broker":"74d9fea2.8d044","x":901.4287109375,"y":511.4286193847656,"wires":[]},{"id":"74d9fea2.8d044","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
User avatar
FireWizard
Posts: 1771
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by FireWizard »

Good evening @hoeby,

I checked your flow and everything is correct.
The way you programmed it, requires that the name of the virtual blinds/percentage switch has to be quite cryptic, but that is up to you.

See my example:

Screenshot_Shelly2.png
Screenshot_Shelly2.png (41.32 KiB) Viewed 2139 times
If you move the slider, the value send to Shelly will change as well.
But as you can see, in order to make your flow functioning the name of this virtual switch is quite cryptic. But maybe it is okay for you.

Please test the complete flow, including the part from Shelly to Domoticz, because I changed that.
Look also if the different messages go to the right output of the switch node.

Screenshot_Shelly3.png
Screenshot_Shelly3.png (64.93 KiB) Viewed 2139 times
In the debug nodes, you should see the different outputs.

Screenshot_Shelly4.png
Screenshot_Shelly4.png (45.81 KiB) Viewed 2139 times
This flow is not including the blocking of the loop-back.
I suggest that I take the POWER2 output as a condition to block the flow to the Shelly, unless you have another proposal.
The best way is to upgrade your Domoticz, but you know that.

Do not forget to insert the correct IDX number in:
- the Function node "To Domoticz
- the Switch node "Filter Shutter Switch"

If you are satisfied, you can remove all Inject nodes and Debug nodes.

Below find the complete flow:

Code: Select all

[{"id":"fcc52c89.40fcb8","type":"mqtt in","z":"56f1881a.2a6b9","name":"Domoticz Out","topic":"domoticz/out","qos":"2","datatype":"json","broker":"c2d9657a.d81bf8","x":170,"y":340,"wires":[["333a575f.6d0128"]]},{"id":"333a575f.6d0128","type":"switch","z":"56f1881a.2a6b9","name":"Filter Shutter Switch","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"18","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":400,"y":340,"wires":[["d8cc3841.eb817"]]},{"id":"2c8bdab8.88c546","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":850,"y":400,"wires":[]},{"id":"af972d40.75509","type":"mqtt in","z":"56f1881a.2a6b9","name":"Shelly Out - MQTT In","topic":"stat/DZ_SH_A/RESULT","qos":"2","datatype":"auto","broker":"c2d9657a.d81bf8","x":200,"y":200,"wires":[["4936cdd.1c8c034"]]},{"id":"a331717e.bffac","type":"inject","z":"56f1881a.2a6b9","name":"Simulate Shelly Out","topic":"stat/DZ_SH_A/RESULT","payload":"{\"Shutter1\":{\"Position\":64,\"Direction\":0,\"Target\":64}}","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":160,"wires":[["4936cdd.1c8c034"]]},{"id":"efd8ce75.fcd368","type":"function","z":"56f1881a.2a6b9","name":"Prepare To Domoticz","func":"msg.payload = {\"command\":\"switchlight\",\"idx\":18,\"switchcmd\":\"Set Level\",\"level\":msg.payload.Shutter1.Position}\nreturn msg;","outputs":1,"noerr":0,"x":840,"y":140,"wires":[["79ded80.70563a8","cb5324b1.83c65"]]},{"id":"79ded80.70563a8","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1070,"y":100,"wires":[]},{"id":"cb5324b1.83c65","type":"mqtt out","z":"56f1881a.2a6b9","name":"Domoticz In","topic":"domoticz/in","qos":"","retain":"","broker":"c2d9657a.d81bf8","x":1070,"y":140,"wires":[]},{"id":"4936cdd.1c8c034","type":"switch","z":"56f1881a.2a6b9","name":"Split Messages","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"Shutter1","vt":"str"},{"t":"cont","v":"ShutterPosition1","vt":"str"},{"t":"cont","v":"POWER1","vt":"str"},{"t":"cont","v":"POWER2","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":5,"x":440,"y":140,"wires":[["11a8b3a6.bd921c","797d5ce8.065f5c"],["27477d7b.6dd8da"],["71ebf67c.496d68"],["3371904c.cebc6"],[]]},{"id":"91a92a37.bb5a18","type":"inject","z":"56f1881a.2a6b9","name":"Power 2 ON","topic":"stat/DZ_SH_A/RESULT","payload":"{\"POWER2\":\"ON\"}","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":80,"wires":[["4936cdd.1c8c034"]]},{"id":"deb751b8.b95878","type":"inject","z":"56f1881a.2a6b9","name":"POWER 2 OFF","topic":"stat/DZ_SH_A/RESULT","payload":"{\"POWER2\":\"OFF\"}","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":120,"wires":[["4936cdd.1c8c034"]]},{"id":"3371904c.cebc6","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":259,"wires":[]},{"id":"11a8b3a6.bd921c","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":100,"wires":[]},{"id":"797d5ce8.065f5c","type":"json","z":"56f1881a.2a6b9","name":"","property":"payload","action":"","pretty":false,"x":630,"y":140,"wires":[["efd8ce75.fcd368","754432cb.b67bb4"]]},{"id":"754432cb.b67bb4","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":850,"y":100,"wires":[]},{"id":"71ebf67c.496d68","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":219,"wires":[]},{"id":"27477d7b.6dd8da","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":180,"wires":[]},{"id":"d8cc3841.eb817","type":"function","z":"56f1881a.2a6b9","name":"Prepare Shelly","func":"msg.topic = \"cmnd/\" + msg.payload.name + \"/shutterPosition\";\nmsg.payload = msg.payload.svalue1;\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":340,"wires":[["2c8bdab8.88c546","edd1c6fd.66ded8"]]},{"id":"edd1c6fd.66ded8","type":"mqtt out","z":"56f1881a.2a6b9","name":"Shelly In","topic":"","qos":"","retain":"","broker":"c2d9657a.d81bf8","x":840,"y":340,"wires":[]},{"id":"c2d9657a.d81bf8","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Awaiting your feedback.

Regards.
hoeby
Posts: 530
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by hoeby »

Goodeving FireWizard

I know about the update. It is on the wish list to get it done as soon as possible.
But because of the nice wetter we are in. The garden and other projects have to be done first.

The flow works.

Tested:
- Set the shelly tasmota webpage slide to a value. The percentage is send to Domoticz --> Works
- Set the shelly tasmota by hardware switches. The percentage is send to Domoticz --> Works
- Moved the slide in Domoticz. Shelly response to it and moves to the same percentage --> Works

For testing i removed first the line to shelly/in and after that the line to domoticz/in (and restored the shelly/in).
This to prevent the loop

It is not possible to only use the POWER2 output for preventing loops.
POWER2 is related to relay2. Which is for moving the shutter down.
POWER1 is related to relay1. Which is for moving the shutter up.
When POWER1 is active, POWER2 will not give a status change.
When using the POWER, then both POWER1 and POWER2 need to be used.

greetz Paul
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
User avatar
FireWizard
Posts: 1771
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by FireWizard »

Hello Paul @hoeby

You wrote:
It is not possible to only use the POWER2 output for preventing loops.
POWER2 is related to relay2. Which is for moving the shutter down.
POWER1 is related to relay1. Which is for moving the shutter up.
When POWER1 is active, POWER2 will not give a status change.
When using the POWER, then both POWER1 and POWER2 need to be used.
Can you test, that the information of both POWER1 and POWER2 are reported at Output 3 (for POWER1) and output 4 (for POWER2),
if you move the shutter up, resp down.

Please confirm,

Regards
hoeby
Posts: 530
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by hoeby »

FireWizard wrote: Monday 01 June 2020 22:46 Please confirm,
This is the output from both debug for POWER1 and POWER2

2-6-2020 07:27:37node: msg.payload
stat/DZ_SH_A/RESULT : msg.payload : string[15]
"{"POWER1":"ON"}"
2-6-2020 07:27:38node: msg.payload
stat/DZ_SH_A/RESULT : msg.payload : string[16]
"{"POWER1":"OFF"}"
2-6-2020 07:27:42node: msg.payload
stat/DZ_SH_A/RESULT : msg.payload : string[15]
"{"POWER2":"ON"}"
2-6-2020 07:27:44node: msg.payload
stat/DZ_SH_A/RESULT : msg.payload : string[16]
"{"POWER2":"OFF"}"
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
User avatar
FireWizard
Posts: 1771
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by FireWizard »

Hello Paul @hoeby,

Thank you for your information.
For testing i removed first the line to shelly/in and after that the line to domoticz/in (and restored the shelly/in).
This to prevent the loop
This is the next step (and last step) to solve.

You have several options to this.

1. You know it, is to upgrade to the latest stable 2020.2, as this has the option to prevent a MQTT loop.

2. The solution in Node Red.

I tested it with Domoticz v2020.2 build 12117. (currently the latest beta) running on a Raspberry Pi 1B (1st generation)

I decided not to use POWER1 and/or POWER2.
The goal is to prevent, that any message send to Domoticz is returned to the Shelly device.
So, I use the current output 1 on the switch node. (I left all the other outputs on the switch node, for future use, if desired. However you may remove these, if you are sure, that they do not have any function).

In order to make that function work, you have to install 1 additional node, if not done before.
To do so, go to the "Hamburger" menu and select "Manage palette". Go to "Install" and search for: "node-red-contrib-simple-gate".
Install this module.
For information, see: https://flows.nodered.org/node/node-red ... imple-gate.

The flow, without all debug nodes and inject nodes, looks like:

Screenshot_Shelly5.png
Screenshot_Shelly5.png (39.72 KiB) Viewed 2108 times
At the end it has become a rather simple flow. I believe much simpler as the flow you posted some posts ago.

Find the complete flow, with the Debug nodes and Inject nodes, below.

Code: Select all

[{"id":"af972d40.75509","type":"mqtt in","z":"56f1881a.2a6b9","name":"Shelly Out - MQTT In","topic":"stat/DZ_SH_A/RESULT","qos":"2","datatype":"auto","broker":"c2d9657a.d81bf8","x":200,"y":200,"wires":[["4936cdd.1c8c034"]]},{"id":"a331717e.bffac","type":"inject","z":"56f1881a.2a6b9","name":"Simulate Shelly Out","topic":"stat/DZ_SH_A/RESULT","payload":"{\"Shutter1\":{\"Position\":32,\"Direction\":0,\"Target\":64}}","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":160,"wires":[["4936cdd.1c8c034"]]},{"id":"efd8ce75.fcd368","type":"function","z":"56f1881a.2a6b9","name":"Prepare To Domoticz","func":"msg.payload = {\"command\":\"switchlight\",\"idx\":18,\"switchcmd\":\"Set Level\",\"level\":msg.payload.Shutter1.Position}\nreturn msg;","outputs":1,"noerr":0,"x":840,"y":140,"wires":[["79ded80.70563a8","cb5324b1.83c65"]]},{"id":"79ded80.70563a8","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1070,"y":100,"wires":[]},{"id":"cb5324b1.83c65","type":"mqtt out","z":"56f1881a.2a6b9","name":"Domoticz In","topic":"domoticz/in","qos":"","retain":"","broker":"c2d9657a.d81bf8","x":1070,"y":140,"wires":[]},{"id":"4936cdd.1c8c034","type":"switch","z":"56f1881a.2a6b9","name":"Split Messages","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"Shutter1","vt":"str"},{"t":"cont","v":"ShutterPosition1","vt":"str"},{"t":"cont","v":"POWER1","vt":"str"},{"t":"cont","v":"POWER2","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":5,"x":440,"y":140,"wires":[["11a8b3a6.bd921c","797d5ce8.065f5c","f4a907f1.37231"],["27477d7b.6dd8da"],["71ebf67c.496d68"],["3371904c.cebc6"],[]]},{"id":"91a92a37.bb5a18","type":"inject","z":"56f1881a.2a6b9","name":"Power 2 ON","topic":"stat/DZ_SH_A/RESULT","payload":"{\"POWER2\":\"ON\"}","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":80,"wires":[["4936cdd.1c8c034"]]},{"id":"deb751b8.b95878","type":"inject","z":"56f1881a.2a6b9","name":"POWER 2 OFF","topic":"stat/DZ_SH_A/RESULT","payload":"{\"POWER2\":\"OFF\"}","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":120,"wires":[["4936cdd.1c8c034"]]},{"id":"3371904c.cebc6","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":259,"wires":[]},{"id":"11a8b3a6.bd921c","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":100,"wires":[]},{"id":"797d5ce8.065f5c","type":"json","z":"56f1881a.2a6b9","name":"","property":"payload","action":"","pretty":false,"x":630,"y":140,"wires":[["efd8ce75.fcd368","754432cb.b67bb4"]]},{"id":"754432cb.b67bb4","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":850,"y":100,"wires":[]},{"id":"71ebf67c.496d68","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":219,"wires":[]},{"id":"27477d7b.6dd8da","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":180,"wires":[]},{"id":"4ed64dc1.307d1c","type":"mqtt in","z":"56f1881a.2a6b9","name":"Domoticz Out","topic":"domoticz/out","qos":"2","datatype":"json","broker":"c2d9657a.d81bf8","x":170,"y":400,"wires":[["bbe6f991.08fa2"]]},{"id":"bbe6f991.08fa2","type":"switch","z":"56f1881a.2a6b9","name":"Filter Shutter Switch","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"18","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":400,"y":400,"wires":[["593177dc.96a45"]]},{"id":"e80893e.7b469f","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":870,"y":460,"wires":[]},{"id":"593177dc.96a45","type":"function","z":"56f1881a.2a6b9","name":"Prepare Shelly","func":"msg.topic = \"cmnd/\" + msg.payload.name + \"/shutterPosition\";\nmsg.payload = msg.payload.svalue1;\nreturn msg;","outputs":1,"noerr":0,"x":660,"y":400,"wires":[["e80893e.7b469f","1304705f.9e7fa"]]},{"id":"eae40a75.f4b5d8","type":"mqtt out","z":"56f1881a.2a6b9","name":"Shelly In","topic":"","qos":"","retain":"","broker":"c2d9657a.d81bf8","x":1020,"y":400,"wires":[]},{"id":"1304705f.9e7fa","type":"gate","z":"56f1881a.2a6b9","name":"Gate","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":850,"y":400,"wires":[["eae40a75.f4b5d8","2e506cd9.087e74"]]},{"id":"a03c44f.d5a0cb8","type":"trigger","z":"56f1881a.2a6b9","op1":"","op2":"open","op1type":"pay","op2type":"str","duration":"200","extend":true,"units":"ms","reset":"","bytopic":"all","name":"","x":860,"y":320,"wires":[["1304705f.9e7fa","fdcae9a7.3406d8"]]},{"id":"fdcae9a7.3406d8","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1050,"y":320,"wires":[]},{"id":"f4a907f1.37231","type":"change","z":"56f1881a.2a6b9","name":"Set Control","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"close","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":320,"wires":[["a03c44f.d5a0cb8"]]},{"id":"2e506cd9.087e74","type":"debug","z":"56f1881a.2a6b9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1090,"y":460,"wires":[]},{"id":"c2d9657a.d81bf8","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Again change the IDX 18 for your IDX number (109)

As said, I tested it on a Raspberry Pi 1B. In this case I needed a delay of 200 ms. If you have faster hardware, you may want to decrease this value to e.g. 100 ms. 100 ms. on my RPi1B was not enough and the message was returned.

So I suggest, test it and I await your response.

Regards
hoeby
Posts: 530
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: [NodeRed], Shelly 2.5 tasmota shutter <-> Domoticz

Post by hoeby »

I added the last flow and started testing.
I noticed that i neede the trigger to put on 250ms.
When having the trigger on that value then i and can switch up/down without loops.

But i don't exactly understand the working of the gate.
The "set control" makes the commands for the gate. And the trigger is to keep the command high, otherwise it switches back to open.

Is there a good way to define the trigger milliseconds. or is it just try to don't have a loop?
The connected debug after the gate i monitored, if there are messages comming in the debug, when controlling the shelly by hardware/browser. Non is going tru the gate.

On 200ms i sometimes noticed that it loops.
I use a Pi3B+. And your where saying that a faster board, the time could be lower.
Therefor i thoughed, maybe the timer is that high, because it looks to the second message which is send. Therefor i tried with 100 and 125ms, but lowering makes it worse.

What is tested, with trigger on 250ms:
- Set hardware switch for DOWN. Relay shelly switches on and starts moving. Value percentage domoticz goes from 0 to 100 without issues
- Set hardware switch for UP. Relay shelly switches on and starts moving. Value percentage domoticz goes from 100 to 0 without issues
- Moved the slider in shelly browser. This for UP and DOWN. Domoticz response the same as manual control. No issues.
- Moved the slider in domoticz. This for UP and DOWN. No issues.
- Set hardware switch for UP, immediatly after that to DOWN and that a few times after each other. All without issues. This test is done with the idea: When you manually controll UP, but you needed DOWN. So you switch quickly from direction.

This is in a few words what i tested. Every test row is not down once, but Multi times. After that again, to test if the issues that i had with my flow are gone. And they are.

Thanks FireWizard
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests