What plug w/ current/power measurement? Use case: emit alert if run time > 1 min

Hi there,

Use case: I want to monitor a water pump. I want to get alerted if the pump runs for more than 1 minute.

I tried w/ a TuYa plug.

  • I observed that it doesn’t always report as soon as the power changes. Consequence: my device stopped already, but the plug didn’t report 0 current or power. Only after about 5 minutes these values were updated.
  • I observed that neither this plug or other ZigBee plugs cannot queried for this param. The doc says:

Instantaneous measured power. Value can be found in the published state on the power property. It’s not possible to read (/get) or write (/set) this value.

It’s not clear to me if this a limitation of zigbee2mqtt. E.g. some missing JS code to do conversion or so. Or it’s a hardware limitation.

Have you got some hints on what hardware I could use? ZigBee, or Wifi, or whatever?

Thanks in advance.

Maybe let us know what country - so no one suggests one not suitable.

Personally I would probably build my own using an ESP32 and a CT clamp. Then you have full control of the sensor update frequency.

What current does this motor draw?

It depends on how technically competent you are as to the way to approach this. If you want a quick response, having all the timing in the sensor unit would be the way to go.

I would look at either a split core or Hall effect current sensor attached to the ADC input of an ESP32, a simple resettable timer loop counting off 1 minute. Stop or reset while the ADC input is below a pre-set threshold (low enough to know the motor is running and high enough to not be triggered by noise).

If the timer gets to 1 minute, spit out an alert to an MQTT topic. Doesn’t need to be anything long, A state change from 0 to 1 would suffice. HA will react as programmed. You could add birth and death notices if you like.

Hall Effect Sensor : https://www.makerstore.com.au/product/elec-sensor-hall-acs712/
split-core current sensor: Measure current with Arduino Split Core Current Transformer CT

From my experience, a couple comments:

  1. With pretty much any power monitoring device, if you are only seeing data update on the order of 5 minutes, I thing there is something else causing these long intervals. As soon as I saw your words ‘water pump’, I wondered how far away this was from your hubs and/or what kind of ‘shields’ are between the sensor at the pump and your hubs. Any device with decent network connection should be showing multiple reading per minute.

  2. Tuya stuff is not a great place to start an ‘adventure’ in what you are trying to accomplish IMHO. Just a lot of gotchas. If you search the various forums around most Tuya devices. It’s not that they can not be a useful sensor, just that they seem to have a lot of ‘corner case’ issues that you may find. I would recommend finding a more ‘main stream’ device. Search the forums for folks ‘success’ stories and read the zigbee2mqtt database and issues logs to learn from others.

  3. I have looked into the issue around the number of reading/samples that you should expect from most of these power monitoring devices, and from my experience you should see for most devices at least/around 1 to 5 reading per minute. And for the most part from my experience, those will show power changes well within the one minute interval. Don’t get me wrong, these device are NOT megahertz ADC devices. If you toggle a switch attached to most of these device 20 times in a minute, you will be lucky to capture 5 to 10 of those events.

Good hunting!

Since years I’m using a sonoff pow r2 powered by esphome for that task. Full control and ownership (hardware & software wise) makes that a treat :ok_hand:

Works great - never let me down so far and I set the internal update interval to 0.1 seconds so I don’t miss any spikes. :chart_with_upwards_trend:

Actually I also included a “dry run” protection as the (old pump) doesn’t have one. So if the power draw drops under a certain level for a period of time the pump will be turned off to protect it from damage. This all happens on the device thank’s to the magic :mage: of esphome :muscle:

Obviously you can also trigger every alert in HA from/with a esphome node including sending alerts via mail etc. :mailbox_with_mail:

1 Like