Taking action based on observation

(Newbie here. Hi, everybody! Just ordered, not installed or even received yet. Trying to think ahead.)

I have several large power consumers in the house, and I would like to turn those off when power consumption in the house gets “too high”. In other words, if somebody decides it’s a good idea to cook a 12-course meal, while doing all the laundry, ironing clothes and drying their hair, they don’t get to have air conditioning at the same time. I’m trying to figure out how to best do this.

Q1: Has anybody done such a thing: taking real-time action based on IoToWatt measurements? If so, any pointers? (All the use cases I can see are non-real-time ones)

It appears there might not be enough memory on the chip to run a non-trivial algorithm for how to decide when to start turning things off. So the algorithm would have to run on some other device, say a Raspberry Pi. The obvious idea would be to have the IoTaWatt post its data to that device, and the HTTP (?) handler behind it would then send off the data to both the visualization tool (e.g. emoncms) and to the algorithm, which would then switch that device’s GPIO pins in a suitable fashion to turn off AC. However, that would need to do real-time communications over WiFi, and that sounds like a suboptimal idea :slight_smile:

Q2: Has anybody taken the data off the chip in real time using something else than WiFi? E.g. serial? If so, any pointers?

Q3: If not, it seems possible (again, I have not played with the system so I may be totally wrong) to add a few lines of code to the firmware that writes out to serial 28 bytes or so on each cycle (14x2bytes), which would be ready by the device running the algorithm. Does this idea pass the smell test?

All thoughts and pointers very much appreciated!




Hi Johannes,

I understand what you are trying to do. With regards to using the IoTaWatt, MQTT real-time data export is in the works, and that is the way I would recommend getting the data from the IoTaWatt to some programmable logic. I’m not real familiar with the various smart-home hubs available, but I believe openhab will accept MQTT input and may be able to output to sonoff load controllers. So you may be able to do what you want off-the-shelf. You can run the mosquito MQTT broker on a pi and I’m pretty sure openhab runs on it as well.

MQTT would be great feature, no question, but for my use case I still would have to go through WiFi, right? I’d like to avoid that if at all possible because Murphy’s Law has its global maximum as soon as WiFi enters the picture, in my experience.

Good luck with that.

I take it as nobody has done this kind of thing (yet). I’m not surprised, just figured I try my luck asking. We’ll see how it goes.

I am waiting for iotawatt to support MQTT. I currently use MQTT as the transport, Tasmota as the firmware running on Sonoff and other esp8266 derivative devices as sensors and controllers, and NodeRED as the glue logic, with emoncms as the GUI.

I control a dehumidifier in the basement and measure its power utilization and water output to calculate its efficiency (so I can see when it has lost too much of its refrigerant). I also control the vent fan in my bathroom. It automatically turns on when the humidity rises due to taking a shower and automatically turns off when humidity is back down and stable. Alex also can control the fan to make it wife friendly. I am using NodeRED to control heaters and pumps to keep pipes from freezing.

I have an aerated static pile for compost. That is not currently using NodeRED. Instead it is using an older more custom system based on NETMF. It has local control but posts to emoncms. It does have problems with network connectivity that show up every once in awhile. But, that is because of the underlying networking hardware and firmware (the same code has been running flawlessly on a different system which has different older networking HW). Its on the list to move to NodeRED, MQTT, Tastmota.

I don’t find Wi-Fi to be a big problem with the esp8266. It seems generally reliable. But, some of the esp8266 HW is somewhat questionable. My recent theory is that the voltage regulators on some are not quite up to spec, but that is just speculation at this point.

1 Like