Note: The Emporia Vue In-Panel energy monitors are a completely different device. See this excellent gist by Flaviu Tamas for ESPHome support of the in-panel monitors.
Sorry for the late reply, yes, it works with HA Energy Monitoring. I haven’t had any issues at all. In home assistant it just gives you a device with a Watts entity (current wattage) and a kWh entity (cumulative energy consumed). There’s also a Fast Reporting button, which will make it report about every 10 seconds for a few minutes, otherwise it only updates home assistant every 5 minutes unless there is a significant change in power usage.
If you have any problems, send me a PM with the logs or open an issue on github and I’ll be happy to help you.
I had to remove the dash in “vue-utility” and replace it with an underscore, change 5m to 300s, and comment out the names of the LEDs in the output section of the config to get it to install without errors.
I get data from my meter in the ESPHome Logs but it complains about “Unreasonable watts value xxxxxxxx”. I am currently putting back ~1.5 kW to the grid.
Well it appears your code doesn’t handle negative numbers because once the solar stopped feeding the grid, the data was accepted. Let me know if you want more data. Note in the attached graphs, the time scale is NOT the same because “watts” only started to be reported after they crossed the x-axis.
I get “name is an invalid option for output.gpio” which makes sense because there is no argument for name here: GPIO Output — ESPHome
So I have a Rainforest Eagle setup with my smart meter the same time I am working with the Vue and the Eagle reports two total energy values: “From Grid” and “To Grid”.
I checked the readings I was getting and they are as follows:
Meter: 34,845 kWh (as read from the face of the meter)
Vue: 35,038.242 kWh
Eagle: 35,038.245 kWh (“From Grid”)
The difference between what the Eagle/Vue are reporting and what my meter reads is the total value of energy to the grid. In my case it is 193.036 kWh. I am pretty certain the meter is reporting these two numbers separately but have not been able to figure out where the value for “To Grid” is in the data packet.
Ran into all the same issues as @Han_Solo. Got it up and running.
Commented out the the unreasonable Watts check, as it goes unreasonable when I’m producing and pushing back to the grid (negative Watts).
In that case, negative Watts is input_value-16777216. So I have a check if input_value is > 8388608, if true I perform the negative watts calc and publish that, otherwise we’re positive and just publish input value.
As for energy, when I’m pushing back to the grid the kWh reported from the Emporia does not reduce. Apparently the reported value is only energy pulled FROM grid so if you’re pushing back, it just stays constant until you start pulling again when the sun goes down. According to Emporia, the meter isn’t spinning backwards, and there doesn’t appear to be a separate report for energy pushed to the grid. Somehow my meter is accounting for this as the digital display is a bit lower than the reported kWh from the Emporia but I guess it’s not transmitted wirelessly?
My workaround was to report energy pushed back to the grid based on calculation using the reported negative Watt and the time interval it was measured over. So I calculate this in the ESPHome code and publish it over MQTT and then pump it into a utility meter integration in HASS where I account for it on its own energy-TO-grid meter. I’ve got a separate meter for energy-FROM-grid using the reported kWh from Emporia. A sensor with template to calculate the difference will get you net. Separate meters for daily and monthly (or whatever other time interval you like), all taken care of by HASS. Set “delta_value” attribute to true for the energy-TO-grid meter as this needs to be accumulated, whereas the default delta_value of false is appropriate for the energy-FROM-grid meter which is just receiving absolute meter readings.
I’ve updated the code in the repo with the following changes:
It now internally derives kWh produced / consumed. There is a separate vue-utility-solar.yaml that outputs these individual sensor values.
No longer limits the kWh readings to within a fixed range but instead checks that the latest value seen is -/+ a reasonable range from the previous value. This is MAX_WH_CHANGE in emporia_vue_utility.h and the default of 2 kWh should be plenty for most homes (that would be 500A at 240V)
Removed the invalid Name attribute on the LED outputs
Fixed the throttle: 5m, should have been throttle: 5min
Unfortunately the current version ESPHome doesn’t allow state_class: total, only state_class: total_increasing, which means that the old kWh value shouldn’t ever go down. Therefore kWh is now kWh_net for people without local energy production and a direct response from the meter. In the _solar.yaml the state_class: has been removed, which I think means HA won’t want to use it as an energy meter source. The new kWh_consumed and kWh_produced do have state_class: total_increasing so HA should be happy with it.
@something-is-wrong, no, I don’t think the meter is reporting distinct values for consumed / produced. The logged Meter Response Bytes has all the non-zero bytes in the response and what I’ve been able to reverse engineer is documented here. The meter very well may be tracking this separately and just not giving us this info though.
@jrouvier I’m up an running with the revisions I made and at a “I don’t want to mess with it anymore” point, so I don’t think I’ll have time to try out your code in the near term.
Agreed about terms “produced” and even “consumed” aren’t correct. Energy from grid and energy to grid should be the kWh terminology here or imported/exported to be concise.
Calculating net onboard the Emporia seems complicatedunnecessary. I conceded offloading that duty to HASS. Your method did make me think that I should be performing calculations for accumulation of exported energy onboard the Emporia instead of also loading HASS with that. I’d then be publishing the two energy values, imported and exported, simply as absolute meter readings vs. my current mismatched method which is absolute meter reading for imported, and relative to the last report for exported. Using that method I think I’ll still calculate net in HASS, but at least I won’t lose any bits of exported energy data during occasional HASS restarts that happen to execute while exporting energy to the grid.
Did you all connect it to your meter with the emporia software first or flash it and connect it? I’m not sure if my utility provider will need to reprovision the device once its flashed with esphome, or since the install code and MAC of the zigbee portion is stored on the zigbee device, flashing the esp32 won’t break that connection with the meter?
@Alej, you won’t need to reprovision, the MGM111 module handles all the communication with the meter and isn’t touched by flashing the esp32. However, you might want to connect it to the meter with the factory firmware first just to make sure the hardware works and supports your utility.
Great! It seems like the emporia Vue connect I got has an issue. It reports 371 watts all the time. Emporia said it may be defective and they can send another. I’m wondering what could have happened and if flashing esphome will fix the issue, or if the zigbee module can be reflashed? It did a firmware update on the zibgee module as soon as I connected it to Emporia’s app.
I’m so excited to get this flashed with esphome and have it directly in HA. Shipping was delayed and now it doesn’t seem to work. Hopefully the second one they send will work, although I’d prefer to get this one working.
I was able to flash the Vue Connect with ESP home. It must have some issue. It gives the same wattage reading every time it connects. This is the same thing it was doing with the empora firmware, but the wattage is different. With the Emporia firmware it always reported 371 watts. Now it is reporting to esphome 617 watts.
I’m not sure if there is a way to debug and see if it is a hardware issue, or something with the type of meter I have. Its connected to the meter, just doesn’t report the correct wattage.
<EDIT>
I should have read your earlier reply. Sounds like you already have a new one coming. I think we both have the same issue. Disappointing to know it wasn’t solved by flashing; I was hoping I might end up with 2 functioning units! </EDIT>
I just received mine a few days ago, and was waiting to get it set up and working correctly before I flashed it with custom firmware. I also experienced the issue of a constant wattage being reported (mine happens to be 1704 watts). I contacted support and they said they would ship me another unit. They didn’t ask any clarifying questions, didn’t ask me to reboot it, etc. So I’m assuming this is a known issue with the hardware.
I used the chat feature through the app, but it was outside of working hours and they responded through [email protected]. So you can probably use either method.