What should be the first node to start my flow in order to always trigger my logic?

So far everything i have been testing and playing with is the " events: state" node.

Right now im trying to play around with a function to add the timestamp to the payload, so i can use later in a function to do my logic validation. Below are the flow and nodes used for this simple test as well as the output.
My Flow
Screenshot 2020-09-30 200822
The Event State Node
Screenshot 2020-09-30 200633
The function to add the timestamp
Screenshot 2020-09-30 200606
The msg object
Screenshot 2020-09-30 200508

It contains the data, just wondering if for this simple test, this is the best way to start. I eventually want to right logic to check/compare the time to a interval to help insure that the dryer is in fact running before sending a update text.

I don’t think there is a wrong way to begin there if it works.
You can add as many function nodes as you wish and it won’t measurably impact the speed of your flows or your system.

Ofc it can be noted that I think you can add the time with a “Change node” so the script isn’t needed.
Though if you want to add further logic at the top of your flow, then again, it doesn’t matter much how you do it.

:man_shrugging:

If I use the “change” node to add the time to the payload object. Is there a way to capture the moment the state changes and validate that it stays in that state for x amount of time to then let the rest of the logic/flow run?

I was looking at the “wait until” node and seems like it might work, but seems like I would need some sort of value to check against. In this case I would need to know how long the state has been on and if its greater than 10 minutes then go ahead and move along with the rest of the logic.

Is it possible to say create a flow variable as a boolean at the very beginning when the state changes(met both conditions (running for longer than 10 minutes and contact is closed)

Variable = true

Dryer runs for x amount of time and then once the new condition is met, that variable is reset.

Variable = false

This would prevent the flow from executing again when vibration is detected from emptying or just touching the dryer since the door may be closed.

Just looking for some guidance on what nodes to use or consider for this. Today i have already unlinked my IFTTT and sharptools.io from my smart things hub. So im trying to accomplish with node red. I am have success with getting notification and triggering the flow, but its the “duration” combination of the door closed and running for over 10 minutes consecutively that im having issues with.

thank you for the idea and suggestions and will be playing around with that tonight to see what i can do

You don’t need a variable at all, if I’m understanding your goal properly.

All you need to do is check msg.data.new_state.timeSinceChangedMs (or compare the old_state.last_changed against the new_state.last_changed).

This is how I do it for our washer. I have it plugged into a smart plug that monitors energy. It has a baseline of 0.2w, so I have the flow start when the washer goes above 100w and then waits until the power drops back down to 0.2w.

For the dryer, my wife wanted one of the “smart” dryers… so yeah, that one was easy (except for the hit to the bank account lol).

image

2 Likes

See im not having any luck with my smart plug, i have the smartthings plug and in the app, the values never really change enough to setup like yours, what kind of plug are you using?

In the app, the plug always shows Energy Consumption as 0.0 when not in use and 0.2( i assume ) when its running… doing a load now to see what node red reads thru out the cycle.

And the power meter shows in the app as 2.0 when its used, there is no inbetween.

Washer has been running now for about 10 minutes or so and the energy reading is still the same in the app and node red :sob: :sob:

I doubt it is why or part of the reason its not seeing a change, but the energy rating on the washer shows to be 187kwh per year(estimated yearly cost $15
So maybe its not using enough power to register on the plug? :man_shrugging:

Well i just ran a 50 minute wash cycle and the plug never registered any change in the current power and today energy :sob: :sob:

Screenshot 2020-10-02 114807

this stayed the same from the start to finish… :frowning:

Mine is a SmartThings 2019 plug, but directly attached to HA (via ZHA). If you still have yours connected to SmartThings, that could be part of the issue as I know SmartThings does some weird fudging to their calculations for power.

image

I just bought this plug about 1 or 2 months ago, so i assume its also a 2019 version. Model is 7A-PL-W-A1.

And if i were to use the ZHA, would i still need to smartthings hub for this plug?

Ah, that’s the WiFi version which I don’t think HA supports at all and would explain the wonkiness. I’ve not seen many good reviews about them.

If you have a Zigbee (ZHA) one and a controller attached to HA (Nortek stick, Conbee/Raspbee, CC2531, etc), then unless you have other things on SmartThings, the answer would be no. If you want to buy a Zigbee plug, I’d actually recommend going on eBay and look for the Centralite plugs. You can usually find them for $10-$20 and a lot of good sellers sell them in bulk as Centralite is no longer in business (AFAIK). Plus, they work with nearly every Zigbee platform out there (HA, SmartThings, Hubitat, etc) so if you ever wanted to jump platforms, your plugs would still work.

So yours is a smartthings 2019 plug, but its ZigBee and not Wi-Fi?
Where can i get that version? If i can find devices that are not dependent on cloud or hubs, that would be perfect.

I have this one:

Maybe it’s the 2018? Not sure, but it is absolutely Zigbee and not WiFi and not cloud dependent in any way. I have 6 of them spread throughout the house (along with some Centralite plugs) specifically as repeaters for my Zigbee mesh.

This is the USB stick I’m using as well:
https://www.amazon.com/GoControl-CECOMINOD016164-HUSBZB-1-USB-Hub/dp/B01GJ826F8/ref=sr_1_1_sspa?crid=E48J78CU8TRF&dchild=1&keywords=nortek+husbzb-1&qid=1601669335&sprefix=Nortek%2Caps%2C145&sr=8-1-spons&psc=1&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUFZUVZOMlBaSkY0NEQmZW5jcnlwdGVkSWQ9QTEwMDMyMzczR043SVRTV1FLVFlUJmVuY3J5cHRlZEFkSWQ9QTA0NjM2NzYxVU45NlAzU0E2NUs0JndpZGdldE5hbWU9c3BfYXRmJmFjdGlvbj1jbGlja1JlZGlyZWN0JmRvTm90TG9nQ2xpY2s9dHJ1ZQ==

That usb is “the hub” for the zigbee devices to connect to? Or is that not needed?

That’s needed for HA to be able to attach Zigbee devices. Plus, it also has a Z-Wave radio in it as well, so if you ever wanted to add Z-Wave devices to your setup, you can. I’ve been using this stick for about 1.5 years now and absolutely love it.

I really appreciate all the information and links, i have already added to my cart and will probably purchase today to tomorrow :wink:

1 Like

Glad to be of help. When you do order it (them?), you’ll probably have other questions (I know I did!), so make sure to check out the Zigbee sub-forum.

:+1: thanks

Genius! Could you share your code for the change state nodes on the washer and dryer, or the flow? I’m am new to this and I’m not sure how to do a >0.2w state change.

Thanks!

1 Like

This is my washer power. It’s fairly basic:

And this is my wait until:

I see now. I think my problem is I can’t seem to correctly make a template sensor out of my plugs current power attribute.
If the plug is ‘switch.washing_machine’ and the state attribute is ‘current_power_w’. What should I put in my sensor.yaml?
My total noob guess would be something like:

  • platform: template
    sensors:
    washing_machine_power:
    unit_of_measurement: ‘watts’
    friendly_name: ‘Washer Power’
    value_template: “{{ states.switch.washing_machine.attributes.current_power_w }}”