Hoping this is a simple fix, but I can’t figure out how to apply a variable blind positioning using a function node. I tried using both the below in the data field:
"position": msg.position
"position": {{position}}
But the both give off errors.
If I hard code it like this, it works fine:
"position": 50
Any advice would be really appreciated!
[{"id":"ded221b4724b5100","type":"ha-get-entities","z":"359116ad3423020e","name":"Fetch Blinds","server":"df9a019b.0518b","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"cover.master_bedroom_blinds","valueType":"str"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":470,"y":640,"wires":[["a65eccb968e23d0c"]]},{"id":"a65eccb968e23d0c","type":"function","z":"359116ad3423020e","name":"Blinds Switch","func":"if (msg.cron == \"Daily_Sunset\") {\n msg.state = \"close_cover\"\n return msg\n}\nelse if (msg.cron == \"Weekend_Awake\") {\n msg.state = \"set_cover_position\"\n msg.position = 50\n return msg\n}\n\nelse if (msg.cron == \"Weekday_Awake\") {\n msg.state = \"set_cover_position\"\n msg.position = 100\n return msg\n\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":670,"y":640,"wires":[["ea1e05148d106d73"]]},{"id":"ea1e05148d106d73","type":"api-call-service","z":"359116ad3423020e","name":"Toggle Blinds","server":"df9a019b.0518b","version":5,"debugenabled":false,"domain":"cover","service":"{{state}}","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"entity_id\": payload.entity_id,\t \"position\": msg.position \t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":870,"y":640,"wires":[[]]},{"id":"8135558a0283cc25","type":"inject","z":"359116ad3423020e","name":"Test Injection","props":[{"p":"cron","v":"Weekday_Awake","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":280,"y":640,"wires":[["ded221b4724b5100"]]},{"id":"df9a019b.0518b","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]