Live data from Hacker News

Monitoring energy usage with smart plugs, Prometheus and Grafana

ounapuu.ee

91–100 of 190 posts

Re: Monitoring energy usage with smart plugs, Prometheus and Grafana

#91
post #9
post #5

Missing from the blog. The power reading of the Tosmota device should be calibrated: https://tasmota.github.io/docs/Power-Monitoring-Calibration/

I would love a semi-automated way to generate a power-profile for ESP-Home. Find a smart room heater with 3 levels perhaps, and use home assistant to gather values at "Off", "1/3", "2/3", "3/3", with a downstream power plug as reference (and a known consumption of the downstream plug as well). So I can just take my EspHome plug and very quickly generate a standard set of mapping values for voltage and wattage.

The easy way is with a resistive space heater and a multimeter. I keep a big, dumb, thrifted "oil-filled radiator" space heater around just to use as a big, safe 3-speed dummy load with reasonably OK repeatability (nichrome heaters do not have perfect temperature coefficients, but they're stable-enough that using them to measure temperature quickly begins to be a non-starter).

The level of integration you choose is entirely up to you. I don't do this kind of thing much, so I'm OK with kludging together a test rig as-needed with a handheld meter and tearing it apart when I'm done. This makes good use of my own time and tools, according to my personal proclivities.

But if I were doing it often, then I might buy the equivalent of the HOPI meter that Big Clive uses in many of his videos. It displays current and voltage, multiplies them to get power, and also displays power factor -- concurrently, on separate digital displays, in real time.

Or I might build something: A box with a current shunt with some panel-mount meters and appropriate connectors would not be too challenging to put together in an afternoon with parts from Amazon and Lowes, depending on one's ability and desire to deal with sheet metal at home. (I use galvanized steel handy boxes and cover plates from Lowes for all kinds of small-ish stuff. They're cheap, common, and durable-enough.)

Whatever the approach, a simple space heater with multiple literal-speeds seems like a cheap and useful way to make it happen unless you're trying to automate every part of it.

(But by then, making a dumb multi-speed space heater into a "smart" multi-speed space heater that can be activated programmatically with software like ESPHome and some relays is probably pretty much a no-brainer, isn't it?)

Re: Monitoring energy usage with smart plugs, Prometheus and Grafana

#92

i'm trying to nudge Grafana into the direction of IoT/SCADA control, so we can be both, a great way to viz (data sources) and to control (data sinks). not personally a huge fan of having to recommend Home Assistant for that use case :) (i work at Grafana Labs)

could you expand on your comment? what is data sinks as applied to your idea?

similar to how you can make plugins for data sources, you can make plugins for data sinks, like write over modbus, or POST to http API or, publish to some kind of MQTT broker, etc.

since IoT devices have limited storage, usually the metrics are dumped into another system like Prometheus. but that Prometheus data source used plotting cannot be used to control the device, which will have another endpoint and another API, so we need some kind of concept of data sinks. at least that's my idea right now, allow data links configured in the panels to poke some "data sink" with values that are available in the DataFrame or custom-entered into the UI, like we do with traceID for Exemplars, etc.

Re: Monitoring energy usage with smart plugs, Prometheus and Grafana

#93
post #12

Earlier quoted context omitted.

HA is actually pretty debuggable. Just install the SSH plugin, then SSH into the HA box, and then simply "docker exec" into the target HA container.

... and then not have any of your usual development tools, environment, system layout, or repair techniques because you're inside someone else's "works on my system" that they threw over the wall. It's obviously possible to debug what goes on inside a Docker image. It's just not something I'm particularly interested in dealing with, especially under duress.

> ... and then not have any of your usual development tools, environment, system layout, or repair techniques because you're inside someone else's "works on my system" that they threw over the wall.

The thing is, the "it works" is reproducible because of containers. Which is a step above just hoping that it works.

HA is also easy to "patch". You can just install your custom components in `config/custom_components`, it can also be used to "override" core HA files.

Finally, if you are doing intrusive development, you can easily launch HA locally. macOS, Linux, and WSL are supported. You will lose the ability to install add-ons via the addon manager, but that's about it.

FWIW, I had the same aversion to their custom OS and their crazy container-based setup initially. For a couple of years, I used to run HA as a Python app and managed the dependencies manually. Then I tried the HAOS and it... kinda just worked.

Re: Monitoring energy usage with smart plugs, Prometheus and Grafana

#94
post #22
post #8

If someone else wants to try this, I strongly recommend against using WiFi for the plugs, instead use Z-Wave or Zigbee. Wifi is just not meant for this use case, it will be unhappy if you start adding a lot of devices, and it will slow down your main use of WiFi for your phone.

Not the first time I hear this but I have about 20 ESP devices on my WiFi, almost all of them pushing data regularly and polling for instructions (I don't use HA, but a simpler home made solution) and I have no problem at all.

It helps that the IoT things almost invariably use 2.4GHz while your data-hungry computers and phones usually use 5GHz.

Re: Monitoring energy usage with smart plugs, Prometheus and Grafana

#95

One step further. I just installed the Emporia Vue 2 in my distribution box. 16 CTs plus the three mains phases. It's ESP32 based and there is a great ESPHome project that you can flash it with for local only reporting. Add some HA and VictoriaMetrics, and now I can see how the whole house behaves with Grafana. Next up, Zero-Export using this data to steer my little OpenDTU solar plant. We live in such cool times!

Is anyone aware of any other OSHW alternatives to this? Preferably with Ethernet. ESPHome would be preferable. The clones I can find are roughly the same price as the "original" hardware. ATM90E32AS seems to be ~$1 per channel on JLCPCB, so I'd imagine this could be pretty cheap with SMT assembly. My use case is like ~60 circuits.

You can install esphome on Emporia Vue. https://github.com/emporia-vue-local/esphome (not used this myself). Vue V3 has wired ethernet support too.

Re: Monitoring energy usage with smart plugs, Prometheus and Grafana

#96
post #80

Earlier quoted context omitted.

I second that. I replaced a bunch of wall switches with Leviton WiFi smart ones and would never go WiFi again. They're totally unreliable. My Meross smart plugs fair a little better but still lose connectivity now and then (got a bit better with updates).

I hear a lot about reliability issues with various wifi smart devices. I've had perfectly lovely reliability with wifi smart devices in my mixture of zigbee/wifi at home, such that I don't really have a preference. Except for one cheap ESP8266-based wifi relay module that had some liquid damage (not the module's fault), and the LED driver in my very first RGBW light bulb finding death after being used for a few years…

I’ve tried a handful of WiFi light bulbs, smart plugs, and other things. They were connected to a dedicated 2.4GHz access point (MikroTik as well). WiFi signal was fine—had good coverage (access point was central to the small wood frame house, and checking signal strength at device locations showed a great signal) and I live in the middle of a forest and there’s nothing else within range to interfere. Basically best case scenario outside of a lab or something.

I haven’t had a single device that worked reliably. Some worked fairly consistently, but only after a long (and variable) delay. Many others failed to work often enough that, combined with the delays, the workarounds became the normal way of using things.

At this point I’m running basically everything over Z-Wave (via Home Assistant) and it’s been rock solid for me. Especially with the ability to set up direct associations, things like “this dimmer’s state should be synchronized to that dimmer” are very responsive and reliable, not involving my controller or Home Assistant at all.

Hard to say whether you’re lucky or I’m unlucky—most people having a good experience aren’t going to take to the internet to start a crusade about it—but I do occasionally see someone recommending or saying that Z-Wave or Zigbee has been reliable for them… I think yours is the first I’ve read where someone’s been happy with WiFi.

Re: Monitoring energy usage with smart plugs, Prometheus and Grafana

#97
post #44
post #42

Earlier quoted context omitted.

Powerline ethernet dumps an utterly horrifying amount of electrical noise into both the wiring and the surrounding area. Please don't use powerline unless you have no other solution. Note: Powerline ethernet should not be confused with Power Over Ethernet which is perfectly fine.

I'm using it on two outlets after not having enough prescience to install ethernet in my wardrobe-turned-office - got any reading materials?

Don't have any to link off hand, but the basic gist is this:

Electrical wiring of any sort are all antennas to varying degrees, transmitting and receiving electromagnetic signals. Most mains electrical wiring is also unshielded, meaning they readily transmit and receive electromagnetic signals.

Powerline ethernet basically puts ethernet data on mains electrical wiring by utilizing the bands that aren't used for carrying power. This data is very, very noisy in electrical noise terms, and because most wiring also acts as an antenna that noise also gets broadcast everywhere.

Simple electronics like your coffee machine or microwave oven won't care, but more sensitive electronics like radios can in turn receive interference from both the power line and the noise broadcast into the air.

Re: Monitoring energy usage with smart plugs, Prometheus and Grafana

#98

Earlier quoted context omitted.

> because you're inside someone else's "works on my system" that they threw over the wall. FWIW, this can also be called stable state you can retreat to . And build upon, e.g. adding a layer of debugging tools. I don't really like to deal with Docker, but at least I have reasonable certainty it'll work. I prefer system package manager or MSI, but if not that, it beats having to build something when it's near-guarante…

It's certainly within my gamut to jump into an embedded system to debug it, bringing/building tools as I go. I'm just not looking to opt into doing that on something that doesn't need to be that complex in the first place. Same reason I run one decently powerful amd64 server that does many things rather than a stack of Raspberry Pis, one per software package.

But how would you do it differently?

You need to host a bunch of daemons (MQTT, ZWave and ZigBee bridges, and whatever else you might need). And a bunch of these daemons can have their own gnarly dependencies (e.g. they can be written in JS and built with NPM, ugh).

So you kinda _need_ to use Docker to make it at least sane.

And if you're using Docker for the plugins, then why not use it for the HA core itself?

And once you do that, you don't really need much from the host system. So why not use a minimalistic OS instead of something like Debian?

Re: Monitoring energy usage with smart plugs, Prometheus and Grafana

#99

I used IoTaWatt devices, which can be installed in panels. It is a great solution for by circuit monitoring, and has direct influxdb integration so you can use Grafana. Per plug monitoring is cool however for getting specific devices on a circuit. (Short video about the setup: https://www.youtube.com/watch?v=-tcbJCvuJG8 )

Wow it’s a small world. I just discovered your channel recently and love the content. Probably watched the home lab video like 10 times. I have a historic building with 3 vacation rentals that I’m in the process of adding some intelligence and monitoring to, including a raspberry pi kiosk based on one of your videos. Thanks for making them!

That is cool! Indeed there is a good cross section of home automation , software development, power monitoring, and hacker news.

I just did a new video on building a 68030 computer that I suspect will have a much smaller audience!

Re: Monitoring energy usage with smart plugs, Prometheus and Grafana

#100
post #20

Earlier quoted context omitted.

Could you expand on how prometheus or grafana helps you automate? I didn’t know either enabled that.

I think this was supposed to be a reply to one of the Home Assistant threads

Correct. My mistake.
Post reply on HN