Need help with node red and cover lux sensor

Hello,
i need help with my lux sensor and roller shutter control.

It works with lux sensor only.

But I would like to query the status that the roll has, if it is 100 then it should close to 60. If there is a lux change it is still 60 and everything should stay that way.

What am I doing wrong here, I think the error is in the current state node

Here my jaml

[{"id":"dc92d257f8d80dcf","type":"tab","label":"Test Rolladensteuerung","disabled":false,"info":"","env":[]},{"id":"29c95dc881e9674b","type":"switch","z":"dc92d257f8d80dcf","name":"Luxwert","property":"payload.lux","propertyType":"msg","rules":[{"t":"gte","v":"5000","vt":"jsonata"},{"t":"lt","v":"4999","vt":"jsonata"}],"checkall":"true","repair":false,"outputs":2,"x":860,"y":340,"wires":[["a060a533d72998fe","7c3c3edbac59b618"],["25e3973b55c831fb","49ca6d2962cf931a"]]},{"id":"d50f71b8fad74e77","type":"function","z":"dc92d257f8d80dcf","name":"Extract Lux Value","func":"msg.payload = {lux: msg.payload};\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":340,"wires":[["29c95dc881e9674b","fafda9ed09015742"]]},{"id":"feeae131967e3b7f","type":"api-call-service","z":"dc92d257f8d80dcf","name":"Close","server":"ba5847c22e132520","version":5,"debugenabled":false,"domain":"cover","service":"close_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1370,"y":280,"wires":[["586fd9da58dbe015"]]},{"id":"a8820658a74936c4","type":"api-current-state","z":"dc92d257f8d80dcf","name":"Lichtsensor Front","server":"ba5847c22e132520","version":3,"outputs":2,"halt_if":"5000","halt_if_type":"num","halt_if_compare":"gt","entity_id":"sensor.esphome_web_d724cf_lightsensfront","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":350,"y":340,"wires":[["d50f71b8fad74e77","ac44d64249d13095"],[]]},{"id":"63704aaa62496f66","type":"api-call-service","z":"dc92d257f8d80dcf","name":"Open","server":"ba5847c22e132520","version":5,"debugenabled":false,"domain":"cover","service":"open_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1550,"y":380,"wires":[[]]},{"id":"ea4b51a01ccd5532","type":"api-call-service","z":"dc92d257f8d80dcf","name":"Stop","server":"ba5847c22e132520","version":5,"debugenabled":false,"domain":"cover","service":"stop_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1670,"y":280,"wires":[[]]},{"id":"586fd9da58dbe015","type":"delay","z":"dc92d257f8d80dcf","name":"60% zu","pauseType":"delay","timeout":"8","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1520,"y":280,"wires":[["ea4b51a01ccd5532"]]},{"id":"74372ff648da6aa2","type":"delay","z":"dc92d257f8d80dcf","name":"Warte 2 min","pauseType":"delay","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1390,"y":380,"wires":[["63704aaa62496f66"]]},{"id":"d5a3899a3ad0da93","type":"inject","z":"dc92d257f8d80dcf","name":"Abfragen","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":790,"y":80,"wires":[["a8820658a74936c4"]]},{"id":"54e6178f268b87e5","type":"comment","z":"dc92d257f8d80dcf","name":"> 5000","info":"","x":310,"y":280,"wires":[]},{"id":"fafda9ed09015742","type":"debug","z":"dc92d257f8d80dcf","name":"Lux Extract","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":790,"y":480,"wires":[]},{"id":"ac44d64249d13095","type":"debug","z":"dc92d257f8d80dcf","name":"Lux Messwert","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":600,"y":200,"wires":[]},{"id":"8756e2c14842c6d7","type":"inject","z":"dc92d257f8d80dcf","name":"Incect 10001","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10001","payloadType":"num","x":190,"y":580,"wires":[["d50f71b8fad74e77"]]},{"id":"481b28526519a077","type":"comment","z":"dc92d257f8d80dcf","name":"> 5000","info":"","x":850,"y":280,"wires":[]},{"id":"9f9b46caaaac534a","type":"switch","z":"dc92d257f8d80dcf","name":"Position","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"payload = \"close\" and data.attributes.current_position = \"100\"","vt":"jsonata"},{"t":"lt","v":"data.attributes.current_position = \"60\"","vt":"jsonata"}],"checkall":"true","repair":false,"outputs":2,"x":1200,"y":280,"wires":[["feeae131967e3b7f","cc4fb8711e872303"],[]]},{"id":"a060a533d72998fe","type":"api-current-state","z":"dc92d257f8d80dcf","name":"Rollo Büro","server":"ba5847c22e132520","version":3,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","entity_id":"cover.rollo_buro","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"payload","propertyType":"msg","value":"close","valueType":"str"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1030,"y":280,"wires":[["9f9b46caaaac534a","4d0f39e1683c79c1"]]},{"id":"25e3973b55c831fb","type":"api-current-state","z":"dc92d257f8d80dcf","name":"Rollo Büro","server":"ba5847c22e132520","version":3,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","entity_id":"cover.rollo_buro","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"open","valueType":"str"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1030,"y":380,"wires":[["9199b205ef9adda2","776323fae2b1465c"]]},{"id":"9199b205ef9adda2","type":"switch","z":"dc92d257f8d80dcf","name":"Position","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"data.attributes.current_position = \"60\"","vt":"jsonata"},{"t":"gte","v":"data.attributes.current_position = \"100\"","vt":"jsonata"}],"checkall":"true","repair":false,"outputs":2,"x":1200,"y":380,"wires":[["74372ff648da6aa2","7b0166e9bf73ff6e"],[]]},{"id":"4d0f39e1683c79c1","type":"debug","z":"dc92d257f8d80dcf","name":"debug close","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1250,"y":100,"wires":[]},{"id":"776323fae2b1465c","type":"debug","z":"dc92d257f8d80dcf","name":"debug open","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1250,"y":520,"wires":[]},{"id":"cc4fb8711e872303","type":"debug","z":"dc92d257f8d80dcf","name":"debug position close","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1420,"y":180,"wires":[]},{"id":"7b0166e9bf73ff6e","type":"debug","z":"dc92d257f8d80dcf","name":"debug position open","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1420,"y":460,"wires":[]},{"id":"7c3c3edbac59b618","type":"debug","z":"dc92d257f8d80dcf","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1020,"y":100,"wires":[]},{"id":"49ca6d2962cf931a","type":"debug","z":"dc92d257f8d80dcf","name":"debug 4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1040,"y":540,"wires":[]},{"id":"771904639625d114","type":"api-call-service","z":"dc92d257f8d80dcf","name":"Open","server":"ba5847c22e132520","version":5,"debugenabled":false,"domain":"cover","service":"open_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":350,"y":660,"wires":[[]]},{"id":"cd526c3e47d21679","type":"inject","z":"dc92d257f8d80dcf","name":"Inject Open","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":660,"wires":[["771904639625d114"]]},{"id":"7d66ea1d16580bab","type":"inject","z":"dc92d257f8d80dcf","name":"Inject Close","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":720,"wires":[["5cc363a5f2708955"]]},{"id":"5cc363a5f2708955","type":"api-call-service","z":"dc92d257f8d80dcf","name":"Close","server":"ba5847c22e132520","version":5,"debugenabled":false,"domain":"cover","service":"close_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":350,"y":720,"wires":[["c28dcc2ecbbf21f5"]]},{"id":"3bc23a931fc7b7d8","type":"api-call-service","z":"dc92d257f8d80dcf","name":"Stop","server":"ba5847c22e132520","version":5,"debugenabled":false,"domain":"cover","service":"stop_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":650,"y":720,"wires":[[]]},{"id":"c28dcc2ecbbf21f5","type":"delay","z":"dc92d257f8d80dcf","name":"60% zu","pauseType":"delay","timeout":"8","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":500,"y":720,"wires":[["3bc23a931fc7b7d8"]]},{"id":"ba5847c22e132520","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":": ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"default","statusTimeFormat":"h:m","enableGlobalContextStore":false}]

One problem I saw with your flow.

image

The switch node you would use the path to the value in the property section. Then just use the value you are looking for.

image

Using a switch to test two separate values (lux and position) can get a little unwieldy. I put the test in a function. There is no need to use current state as the function node will get the state of the lux and roller position.

[{"id":"eae757e3b7d8df20","type":"function","z":"dc92d257f8d80dcf","name":"roller shade","func":"const lux = global.get('homeassistant.homeAssistant.states[\"sensor.esphome_web_d724cf_lightsensfront\"].state');\nconst position = global.get('homeassistant.homeAssistant.states[\"cover.rollo_buro\"].attributes.current_position');\n\n\nif (lux >= 5000 && position > 60) { // open to 100% test\n    if (position == 100){ // if already 100% do nothing\n        return [null, null];\n    } else { // if less than 100% open to 100%\n        return[msg, null];\n    }\n}\nelse if (lux < 5000 && position <= 60) { // open to 60% test\n    if(position == 60) { // if 60% do nothing\n        return[null, null];\n    } else { // if not 60% set to 60%\n        return [null, msg];\n    }\n}\n","outputs":2,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":810,"y":480,"wires":[["74372ff648da6aa2"],["feeae131967e3b7f"]]},{"id":"63704aaa62496f66","type":"api-call-service","z":"dc92d257f8d80dcf","name":"Open","server":"6b1110b5.183a4","version":5,"debugenabled":false,"domain":"cover","service":"open_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1190,"y":460,"wires":[[]]},{"id":"74372ff648da6aa2","type":"delay","z":"dc92d257f8d80dcf","name":"Warte 2 min","pauseType":"delay","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1030,"y":460,"wires":[["63704aaa62496f66"]]},{"id":"feeae131967e3b7f","type":"api-call-service","z":"dc92d257f8d80dcf","name":"Close","server":"6b1110b5.183a4","version":5,"debugenabled":false,"domain":"cover","service":"close_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1010,"y":520,"wires":[["586fd9da58dbe015"]]},{"id":"ea4b51a01ccd5532","type":"api-call-service","z":"dc92d257f8d80dcf","name":"Stop","server":"6b1110b5.183a4","version":5,"debugenabled":false,"domain":"cover","service":"stop_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1310,"y":520,"wires":[[]]},{"id":"586fd9da58dbe015","type":"delay","z":"dc92d257f8d80dcf","name":"60% zu","pauseType":"delay","timeout":"8","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1160,"y":520,"wires":[["ea4b51a01ccd5532"]]},{"id":"d5a3899a3ad0da93","type":"inject","z":"dc92d257f8d80dcf","name":"Abfragen","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":630,"y":480,"wires":[["eae757e3b7d8df20"]]},{"id":"6b1110b5.183a4","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":false,"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}]

okay, thank you for your answer
I will test it this week in my flow.

It doesn’t work for me, but I’m not sure why.
This may be because the Sonoff roller blinds don’t support set position information via the Overkiz integration.
Or I haven’t figured out how this works yet.

The 2 small flows that open the shade, does that work?

If I understand correctly this roller has no position attribute? ["cover.rollo_buro"].attributes.current_position'

Put the shade entity in this current state and copy the debug value.

[{"id":"0ebf99e7b4fa15a8","type":"inject","z":"0a325c35fc29f44e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":380,"y":3540,"wires":[["1f3a713941c65984"]]},{"id":"1f3a713941c65984","type":"api-call-service","z":"0a325c35fc29f44e","name":"","server":"6b1110b5.183a4","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":560,"y":3540,"wires":[["7d27b1810b5ddb07"]]},{"id":"7d27b1810b5ddb07","type":"debug","z":"0a325c35fc29f44e","name":"debug 181","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":770,"y":3540,"wires":[]},{"id":"6b1110b5.183a4","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":false,"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}]

image

Use the preformatted text button and paste the output where shown

This is how you had it. I made changes to the paths, see if this works.

[{"id":"b4c42b667d2aa294","type":"switch","z":"14d63e9b72b26941","name":"Luxwert","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"5000","vt":"jsonata"},{"t":"lt","v":"4999","vt":"jsonata"}],"checkall":"true","repair":false,"outputs":2,"x":660,"y":340,"wires":[["0d5ca906b568559d","9ee9920469987145"],["159c5d508516d456","bc69b3a20f0f50d4"]]},{"id":"336eb894023039ce","type":"api-call-service","z":"14d63e9b72b26941","name":"Close","server":"","version":5,"debugenabled":false,"domain":"cover","service":"close_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":280,"wires":[["e80fdf1e07b66153"]]},{"id":"e94fa6947303358c","type":"api-call-service","z":"14d63e9b72b26941","name":"Open","server":"","version":5,"debugenabled":false,"domain":"cover","service":"open_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1390,"y":380,"wires":[[]]},{"id":"668c6aba29149a22","type":"api-call-service","z":"14d63e9b72b26941","name":"Stop","server":"","version":5,"debugenabled":false,"domain":"cover","service":"stop_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1410,"y":280,"wires":[[]]},{"id":"e80fdf1e07b66153","type":"delay","z":"14d63e9b72b26941","name":"60% zu","pauseType":"delay","timeout":"8","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1200,"y":280,"wires":[["668c6aba29149a22"]]},{"id":"2cc0d1cc33c30b63","type":"delay","z":"14d63e9b72b26941","name":"Warte 2 min","pauseType":"delay","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1210,"y":380,"wires":[["e94fa6947303358c"]]},{"id":"179e0d7610628995","type":"inject","z":"14d63e9b72b26941","name":"Abfragen","props":[{"p":"payload.lux","v":"homeassistant.homeAssistant.states[\"sensor.esphome_web_d724cf_lightsensfront\"].state","vt":"global"},{"p":"payload.position","v":"homeassistant.homeAssistant.states[\"cover.rollo_buro\"].attributes.current_position","vt":"global"}],"repeat":"300","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":410,"y":340,"wires":[["0d5ca906b568559d","b4c42b667d2aa294"]]},{"id":"bc69b3a20f0f50d4","type":"switch","z":"14d63e9b72b26941","name":"Position","property":"payload.position","propertyType":"msg","rules":[{"t":"lt","v":"60","vt":"num"},{"t":"gte","v":"100","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":880,"y":380,"wires":[["2cc0d1cc33c30b63","298c1de1de051f56"],[]]},{"id":"9ee9920469987145","type":"switch","z":"14d63e9b72b26941","name":"Position","property":"payload.position","propertyType":"msg","rules":[{"t":"gte","v":"100","vt":"num"},{"t":"lt","v":"60","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":880,"y":300,"wires":[["336eb894023039ce"],[]]}]

yes the 2 small flows works

Here is the output

{"_msgid":"4d0fe04d83598afd","payload":1713333854671,"topic":""}

I made a mistake with the set_position, that works now

[{"id":"b528ff7ae4528109","type":"api-call-service","z":"dc92d257f8d80dcf","name":"Close","server":"ba5847c22e132520","version":5,"debugenabled":false,"domain":"cover","service":"set_cover_position","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"{\"position\":60}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":370,"y":1080,"wires":[["7d27b1810b5ddb07"]]},{"id":"ba5847c22e132520","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":": ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"default","statusTimeFormat":"h:m","enableGlobalContextStore":false}]

now i need to test it with the lux sensor

That is what i have now:

There is just no output after the function-node.

[{"id":"81586175f26ac26c","type":"function","z":"dc92d257f8d80dcf","name":"roller shade","func":"const lux = global.get('homeassistant.homeAssistant.states[\"sensor.esphome_web_d724cf_lightsensfront\"].state');\nconst position = global.get('homeassistant.homeAssistant.states[\"cover.rollo_buro\"].attributes.current_position');\n\n\nif (lux >= 5000 && position > 60) { // open to 100% test\n    if (position == 100) { // if already 100% do nothing\n        return [null, null];\n    } else { // if less than 100% open to 100%\n        return [msg, null];\n    }\n}\nelse if (lux < 5000 && position <= 60) { // open to 60% test\n    if (position == 60) { // if 60% do nothing\n        return [null, null];\n    } else { // if not 60% set to 60%\n        return [null, msg];\n    }\n}\n","outputs":2,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":410,"y":720,"wires":[["7a37e4e9f1a18e20","f9625a745e21ab43"],["b7139732719196db","567fcac694f08f35"]]},{"id":"6aada9bd89409ced","type":"api-call-service","z":"dc92d257f8d80dcf","name":"Open","server":"ba5847c22e132520","version":5,"debugenabled":false,"domain":"cover","service":"open_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":830,"y":660,"wires":[[]]},{"id":"f9625a745e21ab43","type":"delay","z":"dc92d257f8d80dcf","name":"Warte 2 min","pauseType":"delay","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":670,"y":660,"wires":[["6aada9bd89409ced"]]},{"id":"5931c902663ccaa3","type":"inject","z":"dc92d257f8d80dcf","name":"Abfragen","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":720,"wires":[["81586175f26ac26c","e4df9cb5cbf84e58"]]},{"id":"7a37e4e9f1a18e20","type":"debug","z":"dc92d257f8d80dcf","name":"open?","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":650,"y":620,"wires":[]},{"id":"b7139732719196db","type":"debug","z":"dc92d257f8d80dcf","name":"close?","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":650,"y":800,"wires":[]},{"id":"567fcac694f08f35","type":"api-call-service","z":"dc92d257f8d80dcf","name":"Close 40%","server":"ba5847c22e132520","version":5,"debugenabled":false,"domain":"cover","service":"set_cover_position","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"{\"position\":60}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":670,"y":760,"wires":[[]]},{"id":"e4df9cb5cbf84e58","type":"debug","z":"dc92d257f8d80dcf","name":"debug 182","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":350,"y":840,"wires":[]},{"id":"ba5847c22e132520","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":": ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"default","statusTimeFormat":"h:m","enableGlobalContextStore":false}]

Try the other flow without the function node.

[{"id":"b4c42b667d2aa294","type":"switch","z":"14d63e9b72b26941","name":"Luxwert","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"5000","vt":"jsonata"},{"t":"lt","v":"4999","vt":"jsonata"}],"checkall":"true","repair":false,"outputs":2,"x":660,"y":340,"wires":[["0d5ca906b568559d","9ee9920469987145"],["159c5d508516d456","bc69b3a20f0f50d4"]]},{"id":"336eb894023039ce","type":"api-call-service","z":"14d63e9b72b26941","name":"Close","server":"","version":5,"debugenabled":false,"domain":"cover","service":"close_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":280,"wires":[["e80fdf1e07b66153"]]},{"id":"e94fa6947303358c","type":"api-call-service","z":"14d63e9b72b26941","name":"Open","server":"","version":5,"debugenabled":false,"domain":"cover","service":"open_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1390,"y":380,"wires":[[]]},{"id":"668c6aba29149a22","type":"api-call-service","z":"14d63e9b72b26941","name":"Stop","server":"","version":5,"debugenabled":false,"domain":"cover","service":"stop_cover","areaId":[],"deviceId":["672510dd0a42cd4c4f7e6838c9f49128"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1410,"y":280,"wires":[[]]},{"id":"e80fdf1e07b66153","type":"delay","z":"14d63e9b72b26941","name":"60% zu","pauseType":"delay","timeout":"8","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1200,"y":280,"wires":[["668c6aba29149a22"]]},{"id":"2cc0d1cc33c30b63","type":"delay","z":"14d63e9b72b26941","name":"Warte 2 min","pauseType":"delay","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1210,"y":380,"wires":[["e94fa6947303358c"]]},{"id":"179e0d7610628995","type":"inject","z":"14d63e9b72b26941","name":"Abfragen","props":[{"p":"payload.lux","v":"homeassistant.homeAssistant.states[\"sensor.esphome_web_d724cf_lightsensfront\"].state","vt":"global"},{"p":"payload.position","v":"homeassistant.homeAssistant.states[\"cover.rollo_buro\"].attributes.current_position","vt":"global"}],"repeat":"300","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":410,"y":340,"wires":[["0d5ca906b568559d","b4c42b667d2aa294"]]},{"id":"bc69b3a20f0f50d4","type":"switch","z":"14d63e9b72b26941","name":"Position","property":"payload.position","propertyType":"msg","rules":[{"t":"lt","v":"60","vt":"num"},{"t":"gte","v":"100","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":880,"y":380,"wires":[["2cc0d1cc33c30b63","298c1de1de051f56"],[]]},{"id":"9ee9920469987145","type":"switch","z":"14d63e9b72b26941","name":"Position","property":"payload.position","propertyType":"msg","rules":[{"t":"gte","v":"100","vt":"num"},{"t":"lt","v":"60","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":880,"y":300,"wires":[["336eb894023039ce"],[]]}]

No, unfortunately that doesn’t work.
the debug node 183, after incect node has no output

Did you set the debug node to complete message object?

image

yes.

The path isn’t correct. If you go to devtools → states. Find each entity and screen shot the attribute list.

here are the screenshots:


The path looks correct but for some reason there is no value. Do you have other flows that work? Can you try any other entity in a current state node with an inject and debug? You should see more than just payload. All the attributes should be in the message.

I have this one only with a on payload

This flow is a injection with a timestamp too, like the shade flow


The debug node 188 send the same as the other

This is what the other entities should display. I am not sure why they are not giving you a value. Could you restart ha and then nodered from the addon page. Then try one of the two entities in the current state node again.

its the same output

Try with just the inject, current state, then debug

[{"id":"0ebf99e7b4fa15a8","type":"inject","z":"0a325c35fc29f44e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":380,"y":3540,"wires":[["1f3a713941c65984"]]},{"id":"1f3a713941c65984","type":"api-call-service","z":"0a325c35fc29f44e","name":"","server":"6b1110b5.183a4","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":560,"y":3540,"wires":[["7d27b1810b5ddb07"]]},{"id":"7d27b1810b5ddb07","type":"debug","z":"0a325c35fc29f44e","name":"debug 181","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":770,"y":3540,"wires":[]},{"id":"6b1110b5.183a4","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":false,"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}]

i found an eror in node red logs so i do a full deploy

and this error appear

your flow give the same output as above