node-red-contrib-sun-position icon indicating copy to clipboard operation
node-red-contrib-sun-position copied to clipboard

set window orientation by context not working (restrict sunlight)

Open panther-sh opened this issue 2 years ago • 5 comments

Problem description: In the tab "sun control" it´s not possible to set the window start/end orientation by context. It has no effect whether the value is stored as a number or string. For me it works only, when defined by the "Azimuth angle".

Bildschirmfoto 2022-03-25 um 10 20 36

System information:

  • Node Version 2.1.1 (latest)
  • Node-Red Version 2.2.2 (latest)

panther-sh avatar Mar 25 '22 09:03 panther-sh

Maybe already fixed in latest beta. Needs to be tested.

Hypnos3 avatar Apr 03 '22 16:04 Hypnos3

With the version 2.2.0-beta3 the problem is not fixed.

This was tested with the following flow:

[{"id":"33dfb932f1a88ea4","type":"tab","label":"shutter_test","disabled":false,"info":"","env":[]},{"id":"00f50f4bb648deb1","type":"blind-control","z":"33dfb932f1a88ea4","name":"","topic":"","addIdType":"none","addId":"","positionConfig":"51f2ee6334e86ebe","autoTrigger":true,"autoTriggerTime":"300000","startDelayTime":10000,"contextStore":"","results":[{"p":"","pt":"msgTopic","v":"","vt":"topic"},{"p":"","pt":"msgPayload","v":"","vt":"level"},{"p":"blindCtrl","pt":"msg","v":"","vt":"ctrlObj"}],"blindIncrement":0.01,"blindOpenPos":1,"blindClosedPos":0,"blindPosReverse":false,"blindPosDefault":"open (max)","blindPosDefaultType":"levelFixed","slatPosDefault":"","slatPosDefaultType":"none","overwriteExpire":"120000","rules":[],"sunControlMode":"16","sunFloorLengthType":"num","sunFloorLength":"0","sunMinDelta":"","blindPosMin":"10%","blindPosMinType":"levelFixed","blindPosMax":"10%","blindPosMaxType":"levelFixed","blindOpenPosOffset":0,"blindClosedPosOffset":0,"sunSlat":"","sunSlatType":"none","smoothTime":"","sunTopic":"","windowTopType":"num","windowTop":"2.2","windowBottomType":"num","windowBottom":"0.1","windowAzimuthStartType":"flow","windowAzimuthStart":"start_angle","windowAzimuthEndType":"flow","windowAzimuthEnd":"end_angle","oversteers":[],"oversteerTopic":"","x":290,"y":300,"wires":[["97ed7f3a27f9e556","33acd3499d160271"],[]]},{"id":"05119aba603c6d81","type":"ui_slider","z":"33dfb932f1a88ea4","name":"","label":"start_angle","tooltip":"","group":"68073fcc97feda1e","order":2,"width":6,"height":1,"passthru":true,"outs":"end","topic":"topic","topicType":"msg","min":"0","max":"360","step":"10","className":"","x":130,"y":140,"wires":[["49948527efe102af"]]},{"id":"0ae896b218489223","type":"ui_slider","z":"33dfb932f1a88ea4","name":"","label":"end_angle","tooltip":"","group":"68073fcc97feda1e","order":3,"width":6,"height":1,"passthru":true,"outs":"end","topic":"topic","topicType":"msg","min":"0","max":"360","step":"10","className":"","x":130,"y":200,"wires":[["c95ca8e77515b93b"]]},{"id":"d7e79ade551b7799","type":"change","z":"33dfb932f1a88ea4","name":"","rules":[{"t":"set","p":"start_angle","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":140,"wires":[[]]},{"id":"9483246405304f29","type":"change","z":"33dfb932f1a88ea4","name":"","rules":[{"t":"set","p":"end_angle","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":200,"wires":[[]]},{"id":"33acd3499d160271","type":"debug","z":"33dfb932f1a88ea4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":450,"y":260,"wires":[]},{"id":"323e713f9b766224","type":"ui_button","z":"33dfb932f1a88ea4","name":"","group":"68073fcc97feda1e","order":6,"width":4,"height":1,"passthru":false,"label":"Trigger","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"testnode_forceOutput","topicType":"str","x":110,"y":360,"wires":[["00f50f4bb648deb1","314d9c2cb62eb8a2"]]},{"id":"97ed7f3a27f9e556","type":"function","z":"33dfb932f1a88ea4","name":"","func":"var newmsg = {\n    topic: \"variable values (context)\",\n    payload:\n        msg.blindCtrl.sunPosition.ts + \"<br>\" +\n        msg.topic + \"<br>\" +\n        msg.payload + \"<br>\" +\n        msg.blindCtrl.reason.state + \"<br>\" +\n        msg.blindCtrl.reason.description + \"<br>\" + \"<br>\"\n}\n\nreturn newmsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":300,"wires":[["643184d782199f1a"]]},{"id":"643184d782199f1a","type":"ui_text","z":"33dfb932f1a88ea4","group":"68073fcc97feda1e","order":8,"width":6,"height":3,"name":"","label":"{{msg.topic}}","format":"{{msg.payload}}","layout":"col-center","className":"","x":610,"y":300,"wires":[]},{"id":"314d9c2cb62eb8a2","type":"blind-control","z":"33dfb932f1a88ea4","name":"","topic":"","addIdType":"none","addId":"","positionConfig":"51f2ee6334e86ebe","autoTrigger":true,"autoTriggerTime":"300000","startDelayTime":10000,"contextStore":"","results":[{"p":"","pt":"msgTopic","v":"","vt":"topic"},{"p":"","pt":"msgPayload","v":"","vt":"level"},{"p":"blindCtrl","pt":"msg","v":"","vt":"ctrlObj"}],"blindIncrement":0.01,"blindOpenPos":1,"blindClosedPos":0,"blindPosReverse":false,"blindPosDefault":"open (max)","blindPosDefaultType":"levelFixed","slatPosDefault":"","slatPosDefaultType":"none","overwriteExpire":"120000","rules":[],"sunControlMode":"16","sunFloorLengthType":"num","sunFloorLength":"0","sunMinDelta":"","blindPosMin":"10%","blindPosMinType":"levelFixed","blindPosMax":"10%","blindPosMaxType":"levelFixed","blindOpenPosOffset":0,"blindClosedPosOffset":0,"sunSlat":"","sunSlatType":"none","smoothTime":"","sunTopic":"","windowTopType":"num","windowTop":"2.2","windowBottomType":"num","windowBottom":"0.1","windowAzimuthStartType":"numAzimuth","windowAzimuthStart":"80","windowAzimuthEndType":"numAzimuth","windowAzimuthEnd":"280","oversteers":[],"oversteerTopic":"","x":290,"y":420,"wires":[["3b0653b789eb1e8e","e88da65a12d3ea8e"],[]]},{"id":"e88da65a12d3ea8e","type":"debug","z":"33dfb932f1a88ea4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":450,"y":380,"wires":[]},{"id":"3b0653b789eb1e8e","type":"function","z":"33dfb932f1a88ea4","name":"","func":"var newmsg = {\n    topic: \"fixed values\",\n    payload:\n        msg.blindCtrl.sunPosition.ts + \"<br>\" +\n        msg.topic + \"<br>\" +\n        msg.payload + \"<br>\" +\n        msg.blindCtrl.reason.state + \"<br>\" +\n        msg.blindCtrl.reason.description + \"<br>\" + \"<br>\"\n}\n\nreturn newmsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":420,"wires":[["775de48cd59cb54f"]]},{"id":"775de48cd59cb54f","type":"ui_text","z":"33dfb932f1a88ea4","group":"68073fcc97feda1e","order":9,"width":6,"height":3,"name":"","label":"{{msg.topic}}","format":"{{msg.payload}}","layout":"col-center","className":"","x":610,"y":420,"wires":[]},{"id":"49948527efe102af","type":"function","z":"33dfb932f1a88ea4","name":"number to string","func":"if (flow.get(\"numberorstring\") == \"string\"){\n    msg.payload = msg.payload.toString();\n    return msg;\n} else {\n    return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":140,"wires":[["d7e79ade551b7799"]]},{"id":"c95ca8e77515b93b","type":"function","z":"33dfb932f1a88ea4","name":"number to string","func":"if (flow.get(\"numberorstring\") == \"string\") {\n    msg.payload = msg.payload.toString();\n    return msg;\n} else {\n    return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":200,"wires":[["9483246405304f29"]]},{"id":"84055bdff833b08d","type":"ui_switch","z":"33dfb932f1a88ea4","name":"","label":"Number / String","tooltip":"","group":"68073fcc97feda1e","order":1,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"string","onvalueType":"str","onicon":"","oncolor":"","offvalue":"number","offvalueType":"str","officon":"","offcolor":"","animate":false,"className":"","x":140,"y":60,"wires":[["8a614f3d223b5f0d"]]},{"id":"8a614f3d223b5f0d","type":"change","z":"33dfb932f1a88ea4","name":"","rules":[{"t":"set","p":"numberorstring","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":60,"wires":[[]]},{"id":"aaa3d5d2433a2632","type":"ui_spacer","z":"33dfb932f1a88ea4","name":"spacer","group":"68073fcc97feda1e","order":4,"width":6,"height":1},{"id":"f2e98227fb608c0f","type":"ui_spacer","z":"33dfb932f1a88ea4","name":"spacer","group":"68073fcc97feda1e","order":5,"width":1,"height":1},{"id":"67d589652cb0f907","type":"ui_spacer","z":"33dfb932f1a88ea4","name":"spacer","group":"68073fcc97feda1e","order":7,"width":1,"height":1},{"id":"51f2ee6334e86ebe","type":"position-config","name":"test","isValide":"true","angleType":"deg","timeZoneOffset":"99","timeZoneDST":"0","stateTimeFormat":"3","stateDateFormat":"12","contextStore":""},{"id":"68073fcc97feda1e","type":"ui_group","name":"restrict sunlight - test","tab":"342dcfba1ad09fb5","order":2,"disp":true,"width":"6","collapse":false,"className":""},{"id":"342dcfba1ad09fb5","type":"ui_tab","name":"Shutter - Testflow","icon":"fa-bug","order":3,"disabled":false,"hidden":false}]

panther-sh avatar Apr 07 '22 17:04 panther-sh

Ok, I found the Bug. Should be fixed in one of the next releases.

Hypnos3 avatar Apr 11 '22 21:04 Hypnos3

With the version 3.0.0-alpha1 the problem seems to be fixed. It work as expected. Thank you very much for the quick response!

panther-sh avatar Apr 13 '22 17:04 panther-sh