Add demand variable to electricity pulse counter
carlyler last edited by carlyler
Great work here MySensors team and thank you for sharing. I am just getting started.
After some struggling with my first controller choice I tried Domoticz, with the development branch, and sensors attached to the ESP8266 GW came right up! However, I immediately need help. I cannot find anything that explains how to add a variable to a sensor and get it recognized in the controller. Can someone please share an example? Others have asked, some have come up with a work around and some have went unanswered. I am not deterred by difficulty, but I need at least an outline to begin the journey.
Why am I trying to do this: Our electric plan has a demand component so it is very handy to see and track that value. Obviously, the pulse rate, or "interval" in the MySensor example, is the demand I just need to get that displayed in the controller.
edit: sorry, after reading my post and looking at some old code I realized your doing everything and Watt is the instantaneous demand, however what I am needing is the power company's demand, which is calculated over a 30min interval. Since I have Watts, I have 2 choices: 1) record that in the sensor and send it up, or 2) record it in the controller, then that becomes more of a Domoticz question, I guess. Personally I like 1, but could be persuaded.
carlyler last edited by
My thought process and findings:
I found the custom values, V_VAR[1:5], but I also found a post that says these are not accessible in Domoticz. So this makes me wonder why, and what good are they? Only for developers I surmise.
I wondered who stipulates that S_POWER will only report V_WATT and V_KWH? Then I realized that probably a lot of changes need to occur on both GW and Cntlr to support another var.
I found this Domoticz post from a link in MySensors forum, https://www.domoticz.com/forum/viewtopic.php?t=6517, where he suggests just sending up another sensor, a virtual sensor if you will. I tried it and it works great!
// Register this device as power sensor present(CHILD_ID_HEM, S_POWER); present(CHILD_ID_HEM2, S_POWER);
I still feel 1 or custom variables in each sensor type, that you can have access to in the cntlr, might come in handy.
@carlyler Hi, I am trying to understand what you want to accomplish.. What does the 'demand' value from the electricity company stand for? I would like to assume that this would be expressed in kWh or (avg.) Watt. Either way you can use the standard power sensors in both Domoticz and MySensors. Please let us know.
carlyler last edited by
You have the idea. They watch in 30min intervals the amount of power you consume or average kW. Then they charge you for the largest interval they saw in the billing cycle. I think of as charging and discharging a cap; in code I used a fixed length FIFO and subtract the ends, which are delta 30min.
I agree, and you likely read how I handled it, would you suggest a different approach? Being new it just took me awhile to realize that I could present a virtual sensor.
@carlyler thanks for the explanation. That's an interesting way of charging for electricity... The "virtual sensor" had me a little confused as it is also used to create real virtual devices in Domoticz. I think you handled it the royal way. Although you could argue that the "calculation" should take place in the controller.
Have fun and when you designed a way to lower your electricity bill let me know