Email send when dehumidifier tank is full when im not home

Hi im new to Node-RED i try to make a simple automation with some logic calculations

I want to email me when the dehumidifier tank is full only when im not in home

In the Switch i think that must take the three variables that the output is true and if its true then proceed to the notify

But i think that the switch doesnt see these variables, in current example the water tank is false , and if i turn off wifi of my mobile and i get notify that is wrong, because the state isnt full, i dont know what im doin wrong.

The state of dehumi tank is on,off (on when tank is full)

Use current_state node for making presence decision.
I’d like more trigger_state instead of event_state.

So, trigger_state for the tank connected to current_state. current_state evaluates state of person. It will pass initial message to mail service based on this condition. Whatch out current_state settings on the bottom of the node page. Set first one to none. (sorry I don’t remember its name, I’m writing from memory)

1 Like

Something like this should work.

Just use the trigger state between your Water tank and email. Trigger only if “not_home”

1 Like

First of all thanks for the responses.

I follow your example (if i do it right) and the example of @Dayve67
Unfortunately the data pass on the email notification, event the chris away output false still sending email.
They dont have logic that, true and false = false so why the data pass to the notify?

because this way you built OR logic which is true if at least one operand is true.

You can see green and red squares on diagram which indicates how the flow went through nodes

Make those 2 persons being evaluated one after another. this way you will create AND logic, which results in true only if all operands are true

1 Like

I didn’t knew that with that way creating AND logic, do be ownest i searched on options to make logic calcs but i didn’t found! now my node working thank you very much!

And I have another idea for you.
I would say it’s better and more flexible, because it doesn’t require changing the flow with each person added to home.

The idea behind is to count persons matching particular conditions. Counting entities is provided by Get Entities node

Here is the code you can import to your Node-Red:
[ { "id": "ae0f2f18.6cbb7", "type": "ha-get-entities", "z": "bcb4b1c6.803708", "server": "6cdd0bc8.b8e434", "name": "How many persons in house", "rules": [ { "property": "entity_id", "logic": "is", "value": "person\\.*", "valueType": "re" }, { "property": "state", "logic": "is", "value": "home", "valueType": "str" } ], "output_type": "count", "output_empty_results": false, "output_location_type": "msg", "output_location": "payload", "output_results_count": 1, "x": 480, "y": 220, "wires": [ [ "affb329d.8fa8f" ] ] }, { "id": "affb329d.8fa8f", "type": "switch", "z": "bcb4b1c6.803708", "name": "zero or more", "property": "payload", "propertyType": "msg", "rules": [ { "t": "gt", "v": "0", "vt": "str" }, { "t": "eq", "v": "0", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 710, "y": 220, "wires": [ [ "ee603327.68635" ], [ "fcfa14ef.2feb28" ] ] }, { "id": "d46b853a.df0c78", "type": "server-state-changed", "z": "bcb4b1c6.803708", "name": "Some person state changed", "server": "6cdd0bc8.b8e434", "version": 1, "exposeToHomeAssistant": false, "haConfig": [ { "property": "name", "value": "" }, { "property": "icon", "value": "" } ], "entityidfilter": "person\\.*", "entityidfiltertype": "regex", "outputinitially": true, "state_type": "str", "haltifstate": "", "halt_if_type": "str", "halt_if_compare": "is", "outputs": 1, "output_only_on_state_change": true, "x": 200, "y": 220, "wires": [ [ "ae0f2f18.6cbb7" ] ] }, { "id": "6cdd0bc8.b8e434", "type": "server", "z": "", "name": "Home Assistant" } ]

1 Like

Thanks for help!

That logic is more clean in case of multiple persons, i followed and i change the first event state to my water tank and working very well!!

I want to know if it possible to enable this flow only if we are work that already have zone named zone.vasw_work
in other worlds, i want to get notify if the home is empty AND if the (two inserted) persons that i have is at specified zone (zone.vasw_work) can i do that with get entities node?

i tried to find something like > (IF entity_id1 is “vasw_work” AND entity_id2 is "vasw_work …etc) to return an true or false value to proceed to the next step that is the notify but i dont know if one node can do that think or even how to combine the zone with the device tracker (i have already working life360)