If you have had it previously connected to a different meter, you may need to just call the utility to get them to help. I had previously connected mine at this house, using the web interface, but after disconnecting it once it would not reconnect via the utility’s web interface. I had to call to get it connected.
Hi @jrouvier I am finally back home after a month so I could try this.
Here is the output:
Found multiple options, please choose one:
[1] /dev/ttyACM0 (F5521gw - F5521gw Mobile Broadband Modem)
[2] /dev/ttyACM1 (F5521gw - F5521gw Mobile Broadband Data Modem)
[3] /dev/ttyACM2 (F5521gw - F5521gw Mobile Broadband GPS Port)
[4] MQTT (10.227.79.10)
(number): [15:21:13][D][Vue:282]: Meter Response Bytes 148 to 151: 29 24 05 ae
[15:21:14][D][Vue:487]: Sending request for meter reading
[15:21:14][I][Vue:072]: kWh = 101.272
[15:21:14][I][Vue:094]: kWh = 0.024
[15:21:14][I][Vue:134]: kWh = 116164.516
[15:21:14][I][Vue:113]: Watts = -650.000
[15:21:14][D][Vue:264]: Meter Divisor: 1
[15:21:14][D][Vue:265]: Meter Cost Unit: 1000
[15:21:14][D][Vue:266]: Meter Flags: fb fb
[15:21:14][D][Vue:267]: Meter Energy Flags: 06
[15:21:14][D][Vue:268]: Meter Power Flags: 00
[15:21:14][D][Vue:270]: Meter Timestamp: 2919578
[15:21:14][D][Vue:271]: Meter Energy: 116164.512kWh
[15:21:14][D][Vue:272]: Meter Power: -650W
[15:21:14][D][Vue:282]: Meter Response Bytes 4 to 7: 06 ec 87 a2
[15:21:14][D][Vue:282]: Meter Response Bytes 44 to 47: 00 00 00 01
[15:21:14][D][Vue:282]: Meter Response Bytes 48 to 51: 00 00 03 e8
[15:21:14][D][Vue:282]: Meter Response Bytes 52 to 55: fb fb 00 00
[15:21:14][D][Vue:282]: Meter Response Bytes 56 to 59: 00 ff fd 75
[15:21:14][D][Vue:282]: Meter Response Bytes 148 to 151: 87 37 05 ae
[15:21:19][D][Vue:487]: Sending request for meter reading
[15:21:21][I][Vue:072]: kWh = 101.272
[15:21:21][I][Vue:094]: kWh = 0.024
[15:21:21][I][Vue:134]: kWh = 116164.516
[15:21:21][I][Vue:113]: Watts = -687.000
[15:21:21][D][sensor:127]: 'Watts': Sending state -687.00000 W with 0 decimals of accuracy
[15:21:21][D][Vue:264]: Meter Divisor: 1
[15:21:21][D][Vue:265]: Meter Cost Unit: 1000
[15:21:21][D][Vue:266]: Meter Flags: fb fb
[15:21:21][D][Vue:267]: Meter Energy Flags: 06
[15:21:21][D][Vue:268]: Meter Power Flags: 00
[15:21:21][D][Vue:270]: Meter Timestamp: 2919585
[15:21:21][D][Vue:271]: Meter Energy: 116164.512kWh
[15:21:21][D][Vue:272]: Meter Power: -687W
[15:21:21][D][Vue:282]: Meter Response Bytes 4 to 7: 06 ec 87 a2
[15:21:21][D][Vue:282]: Meter Response Bytes 44 to 47: 00 00 00 01
[15:21:21][D][Vue:282]: Meter Response Bytes 48 to 51: 00 00 03 e8
[15:21:21][D][Vue:282]: Meter Response Bytes 52 to 55: fb fb 00 00
[15:21:21][D][Vue:282]: Meter Response Bytes 56 to 59: 00 ff fd 50
[15:21:21][D][Vue:282]: Meter Response Bytes 148 to 151: 46 53 05 ae
[15:21:24][D][Vue:487]: Sending request for meter reading
[15:21:29][D][Vue:487]: Sending request for meter reading
[15:21:34][D][Vue:487]: Sending request for meter reading
[15:21:39][D][Vue:487]: Sending request for meter reading
[15:21:44][D][Vue:487]: Sending request for meter reading
[15:21:49][D][Vue:487]: Sending request for meter reading
[15:21:54][I][Vue:494]: MGM Firmware Version: 2
[15:21:54][I][Vue:495]: MGM Mac Address: 70:B3:D5:EB:80:00:2D:A0
[15:21:54][I][Vue:496]: MGM Install Code: XX:XX:XX:XX:XX:XX:XX:XX (secret)
[15:21:54][I][Vue:497]: Trying to re-join the meter. If you continue to see this message
[15:21:54][I][Vue:498]: you may need to move the device closer to your power meter or
[15:21:54][I][Vue:499]: contact your utililty and ask them to reprovision the device.
[15:21:54][I][Vue:500]: Also confirm that the above mac address & install code match
[15:21:54][I][Vue:501]: what is printed on your device.
[15:21:54][E][Vue:502]: You can also file a bug at
[15:21:54][E][Vue:503]: https://forms.gle/duMdU2i7wWHdbK5TA
[15:21:54][D][Vue:436]: Got meter join response
[15:21:59][D][Vue:487]: Sending request for meter reading
[15:22:04][D][Vue:487]: Sending request for meter reading
[15:22:09][D][Vue:487]: Sending request for meter reading
[15:22:14][D][Vue:487]: Sending request for meter reading
[15:22:19][D][Vue:487]: Sending request for meter reading
[15:22:24][D][Vue:487]: Sending request for meter reading
[15:22:29][I][Vue:494]: MGM Firmware Version: 2
[15:22:29][I][Vue:495]: MGM Mac Address: 70:B3:D5:EB:80:00:2D:A0
[15:22:30][I][Vue:496]: MGM Install Code: XX:XX:XX:XX:XX:XX:XX:XX (secret)
[15:22:30][I][Vue:497]: Trying to re-join the meter. If you continue to see this message
[15:22:30][I][Vue:498]: you may need to move the device closer to your power meter or
[15:22:30][I][Vue:499]: contact your utililty and ask them to reprovision the device.
[15:22:30][I][Vue:500]: Also confirm that the above mac address & install code match
[15:22:30][I][Vue:501]: what is printed on your device.
[15:22:30][E][Vue:502]: You can also file a bug at
[15:22:30][E][Vue:503]: https://forms.gle/duMdU2i7wWHdbK5TA
[15:22:30][D][Vue:436]: Got meter join response
[15:22:34][D][Vue:487]: Sending request for meter reading
[15:22:39][D][Vue:487]: Sending request for meter reading
[15:22:44][D][Vue:487]: Sending request for meter reading
[15:22:49][D][Vue:487]: Sending request for meter reading
[15:22:52][I][Vue:072]: kWh = 101.272
[15:22:52][I][Vue:094]: kWh = 0.024
[15:22:52][I][Vue:134]: kWh = 116164.516
[15:22:52][I][Vue:113]: Watts = -690.000
[15:22:52][D][Vue:264]: Meter Divisor: 1
[15:22:52][D][Vue:265]: Meter Cost Unit: 1000
[15:22:52][D][Vue:266]: Meter Flags: fb fb
[15:22:52][D][Vue:267]: Meter Energy Flags: 06
[15:22:52][D][Vue:268]: Meter Power Flags: 00
[15:22:52][D][Vue:270]: Meter Timestamp: 2919672
[15:22:52][D][Vue:271]: Meter Energy: 116164.512kWh
[15:22:52][D][Vue:272]: Meter Power: -690W
[15:22:52][D][Vue:282]: Meter Response Bytes 4 to 7: 06 ec 87 a2
[15:22:52][D][Vue:282]: Meter Response Bytes 44 to 47: 00 00 00 01
[15:22:52][D][Vue:282]: Meter Response Bytes 48 to 51: 00 00 03 e8
[15:22:52][D][Vue:282]: Meter Response Bytes 52 to 55: fb fb 00 00
[15:22:52][D][Vue:282]: Meter Response Bytes 56 to 59: 00 ff fd 4d
[15:22:52][D][Vue:282]: Meter Response Bytes 148 to 151: 5a a7 06 ae
[15:22:54][D][Vue:487]: Sending request for meter reading
[15:22:59][D][Vue:487]: Sending request for meter reading
[15:23:04][D][Vue:487]: Sending request for meter reading
[15:23:09][D][Vue:487]: Sending request for meter reading
[15:23:14][D][Vue:487]: Sending request for meter reading
[15:23:19][D][Vue:487]: Sending request for meter reading
[15:23:24][I][Vue:494]: MGM Firmware Version: 2
[15:23:25][I][Vue:495]: MGM Mac Address: 70:B3:D5:EB:80:00:2D:A0
[15:23:26][I][Vue:496]: MGM Install Code: XX:XX:XX:XX:XX:XX:XX:XX (secret)
[15:23:26][I][Vue:497]: Trying to re-join the meter. If you continue to see this message
[15:23:26][I][Vue:498]: you may need to move the device closer to your power meter or
[15:23:26][I][Vue:499]: contact your utililty and ask them to reprovision the device.
[15:23:26][I][Vue:500]: Also confirm that the above mac address & install code match
[15:23:26][I][Vue:501]: what is printed on your device.
[15:23:26][E][Vue:502]: You can also file a bug at
[15:23:26][E][Vue:503]: https://forms.gle/duMdU2i7wWHdbK5TA
[15:23:26][D][Vue:436]: Got meter join response
[15:23:29][D][Vue:487]: Sending request for meter reading
[15:23:34][D][Vue:487]: Sending request for meter reading
[15:23:39][D][Vue:487]: Sending request for meter reading
[15:23:44][D][Vue:487]: Sending request for meter reading
[15:23:49][D][Vue:487]: Sending request for meter reading
[15:23:54][D][Vue:487]: Sending request for meter reading
[15:23:59][I][Vue:494]: MGM Firmware Version: 2
[15:24:00][I][Vue:495]: MGM Mac Address: 70:B3:D5:EB:80:00:2D:A0
[15:24:00][I][Vue:496]: MGM Install Code: XX:XX:XX:XX:XX:XX:XX:XX (secret)
[15:24:00][I][Vue:497]: Trying to re-join the meter. If you continue to see this message
[15:24:00][I][Vue:498]: you may need to move the device closer to your power meter or
[15:24:00][I][Vue:499]: contact your utililty and ask them to reprovision the device.
[15:24:00][I][Vue:500]: Also confirm that the above mac address & install code match
[15:24:00][I][Vue:501]: what is printed on your device.
[15:24:00][E][Vue:502]: You can also file a bug at
[15:24:00][E][Vue:503]: https://forms.gle/duMdU2i7wWHdbK5TA
[15:24:00][D][Vue:436]: Got meter join response
[15:24:04][D][Vue:487]: Sending request for meter reading
[15:24:09][D][Vue:487]: Sending request for meter reading
[15:24:14][D][Vue:487]: Sending request for meter reading
[15:24:19][D][Vue:487]: Sending request for meter reading
[15:24:24][D][Vue:487]: Sending request for meter reading
[15:24:29][D][Vue:487]: Sending request for meter reading
[15:24:34][I][Vue:494]: MGM Firmware Version: 2
[15:24:34][I][Vue:495]: MGM Mac Address: 70:B3:D5:EB:80:00:2D:A0
[15:24:34][I][Vue:496]: MGM Install Code: XX:XX:XX:XX:XX:XX:XX:XX (secret)
[15:24:34][I][Vue:497]: Trying to re-join the meter. If you continue to see this message
[15:24:34][I][Vue:498]: you may need to move the device closer to your power meter or
[15:24:34][I][Vue:499]: contact your utililty and ask them to reprovision the device.
[15:24:34][I][Vue:500]: Also confirm that the above mac address & install code match
[15:24:34][I][Vue:501]: what is printed on your device.
[15:24:34][E][Vue:502]: You can also file a bug at
[15:24:34][E][Vue:503]: https://forms.gle/duMdU2i7wWHdbK5TA
[15:24:34][D][Vue:436]: Got meter join response
[15:24:39][D][Vue:487]: Sending request for meter reading
[15:24:44][D][Vue:487]: Sending request for meter reading
[15:24:49][D][Vue:487]: Sending request for meter reading
[15:24:54][D][Vue:487]: Sending request for meter reading
[15:24:59][D][Vue:487]: Sending request for meter reading
[15:25:04][D][Vue:487]: Sending request for meter reading
[15:25:09][I][Vue:494]: MGM Firmware Version: 2
[15:25:09][I][Vue:495]: MGM Mac Address: 70:B3:D5:EB:80:00:2D:A0
[15:25:09][I][Vue:496]: MGM Install Code: XX:XX:XX:XX:XX:XX:XX:XX (secret)
[15:25:09][I][Vue:497]: Trying to re-join the meter. If you continue to see this message
[15:25:09][I][Vue:498]: you may need to move the device closer to your power meter or
[15:25:09][I][Vue:499]: contact your utililty and ask them to reprovision the device.
[15:25:09][I][Vue:500]: Also confirm that the above mac address & install code match
[15:25:09][I][Vue:501]: what is printed on your device.
[15:25:09][E][Vue:502]: You can also file a bug at
[15:25:09][E][Vue:503]: https://forms.gle/duMdU2i7wWHdbK5TA
[15:25:09][D][Vue:436]: Got meter join response
[15:25:14][D][Vue:487]: Sending request for meter reading
[15:25:19][D][Vue:487]: Sending request for meter reading
[15:25:24][D][Vue:487]: Sending request for meter reading
It seems that while power val is negative and changing, EnergyVal (bytes 4-7) indeed stay the same.
Hence kwh_net can’t go down.
Do you have any conceivable explanation for this?
Based the raw response bytes from the meter, it’s not decreasing kWh when you send power back to the grid. There also isn’t some other magic field that’s this is being reported in. As a workaround I could have the code keep a running total of negative meter watts over time and decrease the reported kWh by that amount as long as the meter-reported kWh never decreases. It’s not going to be as accurate as a meter reported value though, and it’s going to reset to zero when the device reboots, causing huge spikes in your home assistant graphs.
edit: actually, the reset-to-zero on reboot will only be a problem if you use kWh Net
. If you just use kWh Consumed
and kWh Returned
you’ll be fine.
thanks for the tip @doshea I called the utility and had a look at it but they couldnt find an issue
any ideas @jrouvier for why it might not be connecting?
This is actually my first question: Is this supposed to be the case? And if yes, what could be the reason that it is not the case?
I am not sure if you have solar yourself but based on your knowledge, does it always go down with solar/NEM? Maybe it depends on the electricity utility provider? Do you know anyone with solar and PG&E?
Having this option would be a really great workaround, yes.
I understand this can’t be as accurate because we effectively have to calculate the integral over the watts. This naturally causes inaccuracies. Especially since the meter does not provide the data in very dense time stamps. Sad, but would be a good workaround.
Just to make sure, kWh_Consumed would be unchanged and kWh_Returned you would just set as follows:
kWh_Returned(n) = kWh_Returned(n-1) + (kWh_Net(n) == kWh_Net(n-1)) * (watts(n)+watts(n-1))/2 * (time(n)-time(n-1))
?
Or do I have a mistake in my thoughts here?
I’m having the same issue with vue-utility-solar
as @dydx.
Update (2024/10/14):
I was able to fix this by upgrading the mgm111 firmware.
I did this by:
- Flashing the original Emporia firmware and setting it up with the Emporia app.
- Waiting for the app to upgrade the “zigbee firmware”.
- Calling PG&E to reprovision.
- Confirming it worked with Emporia firmware.
- (optional) Confirmed that the mgm111 was sending kWh produced/returned data by sniffing its uart traffic.
- Flashing back to the esphome-based firmware.
- Calling PG&E to reprovision.
- Success!
Behavior:
When my solar produces more than I use:
-
kWh_Net
doesn’t decrease. -
kWh_returned
is always zero. -
kWh_consumed
stops increasing. - Physical meter LCD: net kWh decreases.
- My utility’s website: kWh used is negative (reported in 10 minute intervals and daily).
My setup:
Like @dydx, I have:
- Release v1.2.2
MGM Firmware Version: 2
Meter Flags: fb fb
Meter Response Bytes
: No unexpected non-zero bytes.- Utility: PG&E + solar
I also have:
- Meter: Landis+Gyr FOCUS AXR-SD
Questions:
Does someone have vue-utility-solar
working?
If so, could you please share the following?
MGM Firmware Version
Meter Flags
- Meter make & model
- Utility
@jrouvier, do you have any tips for debugging? I have solar and some reverse engineering experience. Perhaps it would be useful to flash the emporia firmware and observe data on the MGM11 UART? Looks like P4 or P1 might provide convenient access. Though, unfortunately, I can’t find my backup of the emporia firmware
I also wanted to give a huge thank you to @jrouvier for your amazing work here. The quality is excellent. I’ve been using it for >6 months and have saved a ton of energy waste as a result. I especially love the documentation in the repo. Thank you so much for sharing this
P.S. How can we give back?
I am trying to debug this further and I found the following: The kWh value that’s shown directly on the meter does not match the value reported by Vue.
Example: Right now, the meter shows 15823kWh. This matches roughly with my PG&E bill (which showed a reading of 16071kWh on the last bill). Also, maybe 30min ago, the meter shows 15824kWh. This means the net metering on the meter itself works (and also on the PG&E bill).
As you can see from the logs, the number reported by the firmware is around 116164.512kWh. This is far away from the number that’s on the meter itself.
Why do they not match? This really seems fishy. Is there a way to completely reset the Vue and start from scratch? Maybe something got stuck?
(EDIT:: Actually, @ccd , is your kWh shown on the LCD somewhat consistent with the data sent back via the Vue?)
Welcome and happy to hear that I am not the only person with this issue. I meanwhile found someone else who also has Solar with NEM, PG&E and the Vue Utility Connect (but original firmware) and for him, the net energy is reported correctly.
Seems to be the same as mine.
Have you tried this by any chance? I think I have saved the original firmware bin somewhere but I am not sure how to flash it back…
Fully agreed! Thank you very much!
Thanks again @jrouvier for your work here. Im tryinng to debug why my emporia isn’t connecting to the meter my logs were saying that I was getting a meter join response but I was never receiving any data.
So I changed emporia_vue_utility.h in the loop to include a logging line of the message:
case 'j': // Meter reading
handle_resp_meter_join();
ESP_LOG_BUFFER_HEXDUMP(TAG, input_buffer.data, msg_len, ESP_LOG_ERROR);
led_wifi(true);
if (startup_step == 3) {
send_meter_request();
startup_step++;
}
break;
So now my log output looks like this:
[17:58:33][D][Vue:487]: Sending request for meter reading
[17:58:38][I][Vue:494]: MGM Firmware Version: 2
[17:58:38][I][Vue:495]: MGM Mac Address: 70:B3:D5:EB:80:00:24:F7
[17:58:38][I][Vue:496]: MGM Install Code: (secret)
[17:58:38][I][Vue:497]: Trying to re-join the meter. If you continue to see this message
[17:58:38][I][Vue:498]: you may need to move the device closer to your power meter or
[17:58:38][I][Vue:499]: contact your utililty and ask them to reprovision the device.
[17:58:38][I][Vue:500]: Also confirm that the above mac address & install code match
[17:58:38][I][Vue:501]: what is printed on your device.
[17:58:38][E][Vue:502]: You can also file a bug at
[17:58:38][E][Vue:503]: https://forms.gle/duMdU2i7wWHdbK5TA
[17:58:38][D][Vue:436]: Got meter join response
[17:58:38][D][esp-idf:000]: E (19960411) Vue: 0x3ffb2de0 24 01 6a 01 01 0d |$.j...|
[17:58:43][D][Vue:487]: Sending request for meter reading
is that all i should be seeing from your experience?
@Han_Solo and @something-is-wrong you both seem to be Solar/NEM users. PLEASE let us know if the returned energy value (not power value) is a net value or not. I am struggling with this for months and I’m not even sure what the intended behavior is.
What I mean: does your energy value DECREASE when you send energy back to the grid or does it stay constant? In other words, if you plot sensor.kWh_net, do you get a monotonic curve or not?
Please also report:
- does the value match what the meter is showing?
- which utility provider ?
- which meter ?
Thanks!
@dydx No, the unfortunately the Emporia does not report decreasing energy value when I’m exporting. It reports a counter that only goes up when importing and stays constant while exporting, in other words, an import meter. It’s been a year of exporting to the grid and it is now quite different than what the meter displays, whereas it read the same value before my net metering was commissioned. The display on my meter, does as we would expect: it goes down as I’m exporting. There must be separate import and export counters in the meter and the display is showing the difference between them. I have a Landis+GYR Focus AXR-SD meter with PGE. As mentioned in this thread there doesn’t seem to be anything resembling an export counter in the payload that we’re reading with the Emporia, however the stock firmware seems to be able to read it somehow.
I have implemented a workaround that calculates exported energy over a the meter reading time interval based on the reported negative POWER that the Emporia does report. I have coded it so that this calculation only occurs if the current power is negative. HASS grabs this and accumulates it to keep track of total exported. Otherwise, when I’m producing the code will report zero exported and the import just accumulates in the meter value that Emporia grabs (what I call it the import meter).
Unfortunately, after 1 year of using code, it still underestimates the exported energy when I compare with the data that PGE has. It’s possible I have an error as I wrote it myself and I’m not a professional, I’ve been meaning to compare it with what jrouvier eventually deployed, or just download his and see.
Fellow solar user here:
@something-is-wrong: I sent @jrouvier a pull request here from my fork, but haven’t heard anything back.
The fork does effectively what you suggested: breaks out “Watts returned” and “Watts consumed” so that you can create Integration - Riemann sum integral sensor
Helpers in Home Assistant, which can then be used in the Energy component. I called my helpers Energy consumed from grid
and Energy returned to grid
.
My fork also fixes timing issues, so you can e.g. enable the ESPHome Time Source in your device’s ESPHome configuration YAML.
Thanks @jgruen . I’ve actually done something very similar but doing it on the device itself at high resolution. No HA required. I can share details if interested
I’m HIGHLY interested in your solution. I’m running jgruen’s code, but I’m about a year behind you guys and just now starting to try to figure out why net metering doesn’t work.
PG&E w/ 12kw of solar and an Aclara I210+ meter.
I also have a service ticket in to Emporia asking for the protocol documentation for the serial link between the Zigbee transceiver and the ESP32. Never hurts to ask nicely.
@jgruen I’ll take a look at what you came up with. Mine still accumulates errors in either direction with how much I export. Have you tested and compared with what your utility reports?
Here is my yaml:
sensor:
- platform: uptime
name: Uptime Sensor
- platform: custom
lambda: |-
auto vue = new EmporiaVueUtility(id(emporia_uart));
App.register_component(vue);
return {vue->kWh_consumed, vue->kWh_returned, vue->W, vue->kWh_net};
sensors:
- id: kWh_consumed_raw
internal: true
- id: kWh_returned_raw
internal: true
- id: watts_raw
internal: true
- id: kWh_net_raw
internal: true
- platform: copy
id: watts_produced_raw
source_id: watts_raw
internal: true
filters:
- lambda: 'return max(-x, 0.0f);'
# - multiply: 0.001
unit_of_measurement: W
- platform: copy
id: watts_consumed_raw
source_id: watts_raw
internal: true
filters:
- lambda: 'return max(x, 0.0f);'
unit_of_measurement: W
- platform: total_daily_energy
id: kWh_returned
power_id: watts_produced_raw
name: "kWh Returned"
unit_of_measurement: "kWh"
accuracy_decimals: 3
state_class: total_increasing
device_class: energy
# Reduce the rate of reporting the value to
# once every 5 minutes and/or when 0.1 kwh
# have been returned, unless the fast_reporting
# button has been pushed
filters:
- multiply: 0.001
- or:
- throttle: 5min
- delta: 0.1 # <- kWh
- lambda: |-
if (id(fast_reporting)) return(x);
return {};
on_raw_value:
then:
lambda: |-
ESP_LOGI("Vue", "Wh = %0.3f", x);
- platform: copy
id: kWh_consumed
source_id: kWh_consumed_raw
name: "kWh Consumed"
unit_of_measurement: "kWh"
accuracy_decimals: 3
state_class: total_increasing
device_class: energy
# Reduce the rate of reporting the value to
# once every 5 minutes and/or when 0.1 kwh
# have been consumed, unless the fast_reporting
# button has been pushed
filters:
- or:
- throttle: 5min
- delta: 0.1 # <- kWh
- lambda: |-
if (id(fast_reporting)) return(x);
return {};
on_raw_value:
then:
lambda: |-
ESP_LOGI("Vue", "kWh = %0.3f", x);
- platform: copy
name: "Watts Consumed"
id: watts_consumed
source_id: watts_consumed_raw
unit_of_measurement: "W"
accuracy_decimals: 0
state_class: measurement
device_class: power
# Report every 5 minutes or when +/- 20 watts
filters:
- or:
- throttle: 5min
- delta: 20 # <- watts
- lambda: |-
if (id(fast_reporting)) return(x);
return {};
on_raw_value:
then:
lambda: |-
ESP_LOGI("Vue", "Watts = %0.3f", x);
- platform: copy
name: "Watts Returned"
id: watts_returned
source_id: watts_produced_raw
unit_of_measurement: "W"
accuracy_decimals: 0
state_class: measurement
device_class: power
# Report every 5 minutes or when +/- 20 watts
filters:
- or:
- throttle: 5min
- delta: 20 # <- watts
- lambda: |-
if (id(fast_reporting)) return(x);
return {};
on_raw_value:
then:
lambda: |-
ESP_LOGI("Vue", "Watts = %0.3f", x);
- platform: copy
name: "kWh Net"
id: kWh_net
source_id: kWh_net_raw
unit_of_measurement: "kWh"
accuracy_decimals: 3
device_class: energy
# Reduce the rate of reporting the value to
# once every 5 minutes and/or when 0.1 kwh
# have been consumed or returned, unless the fast_reporting
# button has been pushed
filters:
- or:
- throttle: 5min
- delta: 0.1 # <- kWh
- lambda: |-
if (id(fast_reporting)) return(x);
return {};
on_raw_value:
then:
lambda: |-
ESP_LOGI("Vue", "kWh = %0.3f", x);
As you can see, I am getting all the values first as internal “raw” values. The energy consumed I can directly copy (with some filters) because it is already correct. But for kWh_returned I use total_daily_energy to calculate it from watts_produced_raw directly. watts_produced_raw is just defined as return max(-x, 0.0f);
where x is the raw watts value. That’s because the Vue correctly sets power negative when pushing back to the grid (it just doesn’t decrease energy). So now the produced (sent back to grid) power is just the absolute value if it is negative or zero otherwise (it watts>0, we are pulling from the grid). This positive value can now be integrated.
Note I am really working with raw values at the maximum native speed directly on the ESP. This means it is as accurate as it can be given the circumstances. No extra interpolation happens and integration does not happen in HA, where it would get inaccurate if HA dies etc.
Embarrasingly, I’m completely unable to get this yaml config to even compile. I suspect it has to do with indentation of the yaml: I’ve tried a doen ways to line things up, but my command of the “sensors” component of esphome and the way lambdas integrate isn’t sufficient to make it work.
Is there any way you can paste or link to a correctly formatted file?
Thanks!
John
I need to vent. This Zigbee Smartmeter crap is the most frustrating experience ever!
I had it running for nearly a year. Here and there I had to call PG&E to re-provision. Then in August it went downhill. The meter was just reporting the exact same number.
I spent tens of calls, hours on the phone with PG&E. They replaced the meter. New meter first did not connect at all. Now it’s connecting and reporting. Emporia sent me TWO new devices. PG&E is blaming Emporia. Emporia is blaming PG&E. I had PG&E even replace the meter but apart from repreovision for thousand times nothing. And Emporia, apart from sending me yet a FOURTH device, no insight whatsoever. And zero opportunity to debug myself because of this closed proprietary crap. Fuck this.