Some help in current state

I have this:
image

I swear it always worked but now the current state is not forwarding anything anymore.

[{"id":"e143dcb59df2ee80","type":"api-current-state","z":"3732525b.226766","name":"cover > 20%","server":"c6b350c5.b8b3c","version":3,"outputs":2,"halt_if":"$entity().data.new_state.attributes.current_position > 20","halt_if_type":"jsonata","halt_if_compare":"jsonata","entity_id":"cover.rolluik_woonkamer_groot_voor_143","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"data.original_state","propertyType":"msg","value":"","valueType":"str"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":710,"y":2580,"wires":[["319f2fb3319aaec4"],[]]},{"id":"49efa08fa0a5d29a","type":"inject","z":"3732525b.226766","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":540,"y":2580,"wires":[["e143dcb59df2ee80"]]},{"id":"319f2fb3319aaec4","type":"api-call-service","z":"3732525b.226766","name":"","server":"c6b350c5.b8b3c","version":5,"debugenabled":false,"domain":"switch","service":"toggle","areaId":[],"deviceId":[],"entityId":["switch.relay_1_relay_3"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":910,"y":2580,"wires":[[]]},{"id":"c6b350c5.b8b3c","type":"server","name":"Home Assistant","version":5,"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}]

What is the correct syntax/way to see the current state of the cover?

This is all the output it gives:

I want to check this value:
data.new_state.attributes.current_position

I had this:

but it gives:
image

what’s wrong?

Edit: it dos not “pass” anything if the cover is at 60%, thus is does not toggle.

Edit2: hmz… I was tinkering with this before: Current State node - attributes - #11 by Kermit

But now it suddenly does not work anymore I believe

There’s a few problems. Firstly, “State Type” should be Boolean because that’s the result of your JSONata. However, I don’t believe this will stop the flow, it will just show “NaN” rather than true/false.

The main problem is your JSONata - you’ve got a mashup of “current state” and “events: state” nodes. The “new_state” property exists in the latter, but you’re using the former node. You should instead be using it without the data.new_state. part:

$entity().attributes.current_position > 20

Also, you’re only output property is setting msg.data.original_state to an empty string. This won’t cause a problem, but as mentioned above if you’re going to try to use it, the concept of “old_state” is not relevant to the “current state” node.

Thanks!

Right, changed and will observe. Did not even notice it.

Yes, true. In the other link (where I had the problem before, that was my own outcome :-).
I changed that few days ago and I think it now at least “passes”.

Not sure when I changed this back, probably also a few day ago with the old post reading back. now it’s this and combined with the above I think it now passes correctly.

I will observe the “NaN” now it is set to boolean.

More help needed…

This does not pass me the “original payload” value.

I rely on the call server after this node to “turn_{{payload}}” but I receive:
Call-service error. Service not found.