Device to trigger flows based on power level threshold?

Does there exist a device that has a Node-RED integration/node that can trigger flows based on going above or below power consumption thresholds (volts or amps or watts or whatever - I'm not very knowledgeable about electricity)?

I basically want to know when a thing plugged into said device is turned on and when it's turned off.

I've been searching for something that can do this for some time, but I always come up dry.

It appears that this product can send notifications when "usage changes". I had to install the app, create an account, and poke around in their "rules" features to find that feature as their product info is not explicit about it.

You need to find a device that lets you connect to it from Node-RED. Many of the cheap Chinese devices force you to use their own app (in order to grab data about you that they sell to aggregators).

See the recent thread about remote switches that don't need a cloud service. Shelley, SONOFF and TP-Link all have such devices and some of their devices have power-monitoring built in.

Alternatively, you could create your own with a non-in-line sensor and an ESP8266 or other similar device. The non-in-line sensors (the proper name escapes me for some reason) are like clamp meters so that you don't have to mess with mains electricity.

Are you thinking of inductance clamps? Clamp around a wire and read current? Like with a fluke meter?

WHat are you trying to achieve, where are you (Country) and what is your level of electronics expertise ?

Craig

Thanks for the responses.

So my ultimate goal is to be able to turn on all lamps in a room using a old style dumb toggle switch (I hate the decora switches, but that's a separate discussion). The dumb switch controls the top of one outlet. In all but 2 rooms, I achieve this behavior using extension cords, however there are 2 rooms where the outlet is bordered on 2 sides with doors, so I have been trying to figure out a smart-solution.

I previously tried to get the behavior I wanted using a product called the "Quirky Switchflip". That product does exactly what I want, however it's buggy (due to poor design). The remote lights randomly turn off/on either because of interference or occlusion. It sends a continuous signal to a remote outlet when the switch-controlled outlet is powered and the remote outlet turns off when that signal goes away. So sometimes, when the signal is interrupted, it results in the remote lights turning off/on seemingly randomly.

I tried looking for a product that could do this differently: send one signal when power turns on and use a capacitor to send a dying "turn off" signal. But such a product doesn't exist or is prohibitively expensive and/or buggy according to reviews.

I was thinking about this issue over the weekend and had another idea. I have 2 pairs of Quirky Switchflips and if it's interference or signal occlusion, I may be able to eliminate that issue by moving the Switchflip receiver to the same outlet the transmitter is on, but into the continuously powered socket, and plug the nearer lamp into it, with the transmitter directly above it on the wall-switch-controlled socket. With the switchflip receiver plugged into a wifi smart outlet in that continuously powered socket, that smart outlet could send a signal when the lamp turns on and off (controlled by the switchflip from the transmitter on the wall switch socket). I can then use that message to control another outlet across the room (I intend to use a cheap 433Mhz outlet for that, controlled from the Pi). Anyway, that's the idea. It would allow me to keep the old style dumb toggle switch, which I strongly prefer.

I know that's a really hacky solution. If I did not actually prefer a dumb toggle switch, I know I could solve the whole thing with a smart switch, but for multiple reasons, I do not want a smart switch. If you want, we can have that discussion, but suffice it to say, I just want a smart outlet that can send signals based on power usage changes. Partly, I just want to play around and experiment.

I actually discovered that the Currant smart plug works with google home, and I discovered that there's a google home node for node red, so I ordered a Currant outlet to play with (only $40) to see if I could experiment with my idea. I'm hoping that I can configure google home on node red to get the switch to send its power usage signals to node red.

Oh yeah - and I'm in the US.

I did look at the Sonoff and TP-Link solutions. My understanding is that the Sonoff device must get reflashed with 3rd-party software(/firmware?).

I also reached out to the TP-Link folks and they replied and said that they don't have a feature to notify upon power usage changes (but would forward my request to an engineering team to assess the possibility of adding that feature). Is there a 3rd party flash solution to achieve this with the TP-Link device as well?

I'm unfamiliar with inductance clamps. I'm not opposed to opening up the outlet to doing something like that, but I think for the time being, I'd like to exhaust options that don't involve getting into the outlet's wiring.

Have you looked at z-wave? Fibaro wall-plugs have power metering built in. They are expensive so be prepared to drain your wallet...anyway you need a controller as well, not cheap either, I have a aotec z-stick, working fine and there are nodes for z-wave to integrate with NR


I had looked at some z-wave solutions. And I did take a close look at the Nano Switch. In the past, when I've looked, the z-wave stuff required a USB dongle on my pi and I see that this uses a dongle as well. Honestly, unless I get a hub, I don't have any available USB ports on my pi. I guess, other than price and open USB ports, it would be a comparison between CPU load on google home versus something that uses Z-Wave. It also seems that the Fibaro link is for a euro socket. Does it have a US version?

Honestly, I was thinking about the possibility of a RF hub simply because running pilight on my pi is a surprisingly heavy CPU load even with my receiver disabled. I wonder if there's a smart RF outlet that can detect power usage changes... then I could solve 2 problems in one and get a faster pi in the process...

Inductance clamps would probably NOT be a solution. They are fairly expensive, require a more expensive device to read them and generally don't have any useful output you could hook into. They are generally used in labs for current measurement and by electricians in the field. I merely was trying to guess at what @TotallyInformation was looking for. Having said all that it has been years since I last bought my clamp so maybe the price/availability/ease of use is better now.

No, but some of them have useful REST API's that you can simply query on a timer.

This is the kind of thing:

That uses an ESP32 but there are plenty of ESP8266 versions out there too. You can pick up either for just a few $.

https://scidle.com/how-to-use-non-invasive-ac-current-sensors-with-arduino/

If you are comfortable handling mains electricity, here is an alternative plug-in style:

There you go, @TotallyInformation had much better information than I did, I glanced through the list and they look fairly impressive. I don't know how accurate they may be but I would guess more than enough for your needs.

Interesting. These options seem to go to an extent I'm not mentally prepared to get into yet, but I do see the advantages. I'll see how things go with the Currant I ordered. Should arrive on Thursday.

Here's a link to a non-invasive AC current sensor that is very easy to use with Node-RED.

More details of how to use it with a Wemos and a Raspberry Pi are here...

1 Like

First day with the Currant was rather disappointing, but their customer support has been very good. Here are my many issues thus far:

  1. There is No documentation explaining how to set up the device. I had installed the app days before receiving the device and, assuming setup would be the same as all my other smart outlets, and not knowing why it needed Bluetooth and location permission, I had denied both, so days later when I wanted to get it going, there was no clear way to get the device connected to WiFi and nothing stated the process involved Bluetooth. Their chat support responded within a minute however, so it was easily fixed.
  2. The way to set up notifications of starting and stopping usage (based on watts used) was linked in the rules config. You cannot set up specific notifications for usage starting and usage stopping. There's only one toggle for both notification types. Turns out though that the notification message differs. Maybe I can use that.
  3. You cannot set a wattage threshold for the usage notifications, and my switchflip uses 0.9 watts when the connected light is not on and 11 watts when it is on, but the Currant shows it as "on" in both cases. The support guy however was able to set a threshold for me and stated that there was an update coming that would allow the user to set the threshold. Cool.
  4. I only appear to ever get the "usage stopped" notification. There appears to be a bug that is never sending me the "usage started" notification (perhaps due to the manually set threshold).
  5. There is a really inconsistent delay between the usage status change and the notification which in my case ranges from four minutes to over a half hour. The support person can observe the delay on their end and their engineering team is trying to figure it out. They explained that there are three ways the notification is sent. One is on the backend (if I understood correctly - which they say is not the issue since they show a continuous connection), one is a real time local issuing of the notification, and the other is a batch process on a Cron job (which is what I'm seeing). They believe that the real time notification system is not working in my case for some reason.

Lastly, even with the switchflip transmitter and receiver within 2' of one another, I still get the light turning off/on randomly. I can try and get them even closer, but I fear the issue there is some really strong interference. Not their fault though.

Ok. I moved the Switchflip transmitter/receiver from about 2' apart to about 8" apart and that seems to have eliminated the random on/off behavior. The signal must be really weak and really sensitive to interference.

More to report. While I'm waiting (for a resolution from Currant support) to the 2 notification issues, I started looking into how to implement getting the notifications into node red to use as triggers. There is no way to set up a webhook (or anything else for that matter) to keep everything local (that I could find), so I had 3 integration options to explore:

  1. Amazon Alexa
  2. Google Home
  3. SmartThings

I started off looking at SmartThings. I installed the SmartThings app and connected it to my Currant account. I even discovered that I could create an automation triggered by going above or below a Wattage Threshold, but I did not see a way to have that send a message to Node RED to communicate the threshold events it detects in order to trigger a flow in Node RED. I eventually learned that in order to get a working webhook from Currant via SmartThings into Node RED, I would have to "develop" a "smartApp" (i.e. a plugin) for the SmartThings app. And the documentation about doing that was so full of jargon and overkill steps, my head was spinning. I also explored existing SmartThings nodes for node red and they all appear to go only in the opposite direction I need (send commands to Currant as opposed to receive wattage threshold events from Currant). I also looked briefly at IFTTT, but given the recent pay-wall and discovering that I don't appear to have the 3 free applets until I archive all the disabled applets, I just decided to set the whole ST endeavor aside and move on to google home.

I already had the Google Home App, so I added my Currant Outlet to Google Home. I even found a Node RED integration called "Node RED Smart Home Control" that uses node-red-contrib-alexa-smart-home. So I installed the node and set up an account, however, my Currant outlet was not populating in the select list or on the Node RED Smart Home Control website in my account. So I was like... let me just test out manual control of the outlet in the Google Home app... and it was really buggy. Every attempt to turn on/off the outlet resulted in an error and a couple times, the outlet actually changed states, but generally, barely worked at all. I sent the Currant Support folks an email with screenshots showing this new problem with just trying to turn on/off the outlet in google home and moved on...

In the debugging process of google home, I tried deleting the Currant app and reinstalling, which didn't appear to help. And given the trouble with controlling the outlet in google home, I thought I should try turning it on/off using SmartThings. I don't know if it was the app re-install, but I couldn't control the outlet from SmartThings either! And it eventually disabled the outlet in ST and threw up an error. Ugh! This whole experience is a shitshow.

I haven't explored the Alexa option yet, but given these experiences, I'm not eager to attempt it. I'm hoping this is all due to a single root problem that caused my initial issues and that Currant support folks will be able to resolve it. Otherwise, this outlet is getting returned. It would be so cool if it actually worked.

I would use something ESP32/ESP8266 based to do what you want. Say you have one master switch and four you want to control. Connect the master ESP to the master switch and the controls to the lights you want to control. Have the master pass a MQTT message when it is turned on or off and have the controls subscribe and match the state of the master. Or you could use something in NR to control it with some intelligence.

Yes, you would either have to reflash the devices or buy devices already flashed with esphome or tasmota. There are places that sell pre-flashed devices for a small premium.

The reason I prefer ESP solutions for that is response time. I have a lot of zwave and some zigbee devices, they aren't exactly fast response. ESP is right now.

Jon

I’ve had a lot of success using WebSockets to communicate from edge to rest of devices. I run an Apache’s Tomcat (and basically their simple chat example). Node-red then connects to/from that socket.

Challenges with this approach are

  1. Obtaining the seed network bindings (and whether LAN or WAN which sometimes changes the closer to the devices)

  2. Any security.

-Scott