Use of blinds percentage inverted in Smart Nora

Moderator: leecollings

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

Use of blinds percentage inverted in Smart Nora

Post by FireWizard »

Hello @delfisastre,

With respect to your question in viewtopic.php?f=69&t=27588&start=180.

Please find below the answer:

The flow looks as follows:

Screenshot_Blinds_Smartnora.png
Screenshot_Blinds_Smartnora.png (15.17 KiB) Viewed 1379 times
Change the configuration of the MQTT nodes, called "Domoticz Out" and "Domoticz In"
Change also the IDX number in the "Switch" node, so that it matches your IDX number (9), currently 11.
Change also the configuration of the Smart Nora node, so that it fits yours (currently "smartnora config")

For simplicity you will find the contents of the first "Function" ( Domoticz to Google Home) node below:

Code: Select all

msg.topic = msg.payload.idx;

if (msg.payload.nvalue === 1) {
    msg.payload = {
        openPercent : 100
    }
return msg;    
}

else if (msg.payload.nvalue === 0) {
    msg.payload = {
        openPercent : 0
    }
return msg;
}
else if (msg.payload.nvalue === 2) {
    msg.payload = {
        openPercent : msg.payload.svalue1
    }
return msg;
}
else {return null}
The contents of the second "Function" ( Google Home to Domoticz) node you will find below:

Code: Select all

var idx = parseInt(msg.topic);

if (msg.payload.openPercent === 100) {
 msg.payload = { "command": "switchlight", "idx": idx, "switchcmd": "On"};
 }
else if (msg.payload.openPercent === 0) {
 msg.payload = { "command": "switchlight", "idx": idx, "switchcmd": "Off"};
 }
 else {
 msg.payload = {"command": "switchlight", "idx": idx, "switchcmd": "Set Level", "level": msg.payload.openPercent};
 }
return msg
Can you test these and report back?

PLease find the complete flow below:

Code: Select all

[{"id":"e109e3fb.fb1b2","type":"tab","label":"Test","disabled":false,"info":""},{"id":"f8f35d1c.17aa48","type":"mqtt in","z":"e109e3fb.fb1b2","name":"Domoticz Out","topic":"domoticz/out","qos":"2","datatype":"json","broker":"f9f13036.e28b58","nl":false,"rap":false,"x":110,"y":380,"wires":[["b1e44280.bfcc98"]]},{"id":"b1e44280.bfcc98","type":"switch","z":"e109e3fb.fb1b2","name":"Filter Shutter Switch","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"11","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":320,"y":380,"wires":[["7e15f7f9.c65418"]]},{"id":"471ebff2.8f1778","type":"noraf-blinds","z":"e109e3fb.fb1b2","devicename":"Persiana comedor","roomhint":"Menjador","name":"Persiana comedor","passthru":false,"invert":false,"nora":"1c76c7bf.6c61e","topic":"9","x":770,"y":380,"wires":[["7bb24be6.735324"]]},{"id":"88a266be.046a2","type":"mqtt out","z":"e109e3fb.fb1b2","name":"Domoticz In","topic":"domoticz/in","qos":"2","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"f9f13036.e28b58","x":1210,"y":380,"wires":[]},{"id":"7e15f7f9.c65418","type":"function","z":"e109e3fb.fb1b2","name":"Function Shutter In","func":"msg.topic = msg.payload.idx;\n\nif (msg.payload.nvalue === 1) {\n    msg.payload = {\n        openPercent : 100\n    }\nreturn msg;    \n}\n\nelse if (msg.payload.nvalue === 0) {\n    msg.payload = {\n        openPercent : 0\n    }\nreturn msg;\n}\nelse if (msg.payload.nvalue === 2) {\n    msg.payload = {\n        openPercent : msg.payload.svalue1\n    }\nreturn msg;\n}\nelse {return null}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":380,"wires":[["471ebff2.8f1778"]]},{"id":"7bb24be6.735324","type":"function","z":"e109e3fb.fb1b2","name":"Function Shutter Out","func":"var idx = parseInt(msg.topic);\n\nif (msg.payload.openPercent === 100) {\n msg.payload = { \"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"On\"};\n }\nelse if (msg.payload.openPercent === 0) {\n msg.payload = { \"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"Off\"};\n }\n else {\n msg.payload = {\"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"Set Level\", \"level\": msg.payload.openPercent};\n }\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1000,"y":380,"wires":[["88a266be.046a2"]]},{"id":"f9f13036.e28b58","type":"mqtt-broker","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"1c76c7bf.6c61e","type":"noraf-config","name":"smartnora config","group":"Test92","twofactor":"off","twofactorpin":"","localexecution":true,"structure":"Test"}]

Screenshot_Blinds_widget_Smartnora.png
Screenshot_Blinds_widget_Smartnora.png (39.87 KiB) Viewed 1379 times

Regards
delfisastre
Posts: 18
Joined: Wednesday 05 October 2016 11:08
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Catalonia, Barcelona
Contact:

Re: Use of blinds percentage inverted in Smart Nora

Post by delfisastre »

THANK YOU!!!! finaly works! Blinds and Dimmers. :D

Image
Attachments
blinds.png
blinds.png (326.46 KiB) Viewed 1372 times
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests