Where am I going wrong this compare state node?

******** ISSUE IS SOLVED ********

Delivered = 1
Arriving = 1

But when I check to see if Delivered >= Arriving, I get false! What gives?

[{"id":"b3fa64934d254303","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"76f8dbb25b158897","type":"api-current-state","z":"b3fa64934d254303","name":"All packages have been delivered?","server":"ab3e2c53.e3491","version":3,"outputs":2,"halt_if":"$number($entities(\"sensor.mail_amazon_packages_arriving\").state) + 0","halt_if_type":"num","halt_if_compare":"gte","entity_id":"sensor.mail_amazon_packages_delivered","state_type":"habool","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":440,"y":210,"wires":[[],[]]},{"id":"0aaf55829431909c","type":"inject","z":"b3fa64934d254303","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":135,"y":120,"wires":[["76f8dbb25b158897","7023dee7d27eb948","a7658b13a6043433"]]},{"id":"7023dee7d27eb948","type":"api-current-state","z":"b3fa64934d254303","name":"Delivered","server":"ab3e2c53.e3491","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.mail_amazon_packages_delivered","state_type":"num","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":360,"y":90,"wires":[[]]},{"id":"a7658b13a6043433","type":"api-current-state","z":"b3fa64934d254303","name":"Arrriving","server":"ab3e2c53.e3491","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.mail_amazon_packages_arriving","state_type":"num","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":360,"y":150,"wires":[[]]},{"id":"ab3e2c53.e3491","type":"server","name":"AvilaSmartHome","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}]

Just guessing because I am not anything resembling an expert. Are you possibly comparing a number with a string?

1 Like

Close. Look at state type just underneath the “>=” at the bottom left of the card.

Thats not a boolean. :wink:

I thought state type just affects what state the result is shown in, but has no affect on the calc its trying to do. Either way, I tried changing it to number and its still gives me a no pass even when it should be pass. As right now, delivered (0) is less than arriving (1).

I dont believe so, but I dont know of a way to check. The actual entities are as shown below. They come from an integration.

Start with the assumption THAT ALL states coming out of HA are string and if you’re going to compare nonstring assume you’ll have to do some kind of filter or conversion. That dropdown I’d for specifying when it’s ambiguous like if you need 9 the string v. 9 the integer or 9 the float. But that said I think it’s this:

That drop down should say expression not number if you want a formula in that box.

it’s probably barking about that somewhere. See if that does it.

1 Like

That was the secret! Thanks!!

1 Like