Skip to content

Instantly share code, notes, and snippets.

@flaviut
Last active March 12, 2024 00:27
Show Gist options
  • Save flaviut/93a1212c7b165c7674693a45ad52c512 to your computer and use it in GitHub Desktop.
Save flaviut/93a1212c7b165c7674693a45ad52c512 to your computer and use it in GitHub Desktop.
Setting up Emporia Vue 2 with ESPHome
@wbarber69
Copy link

I know that. I got the device online, and figured id try to install from esphome off HAOS as ive been having so many problems doing it from cmd terminal. Its not that i get no output with or without clamps, the logs timeout over and over again when trying to read logs. they arent empty there is nothing being reported.

@wbarber69
Copy link

okay Im not sure whats going on. Now HAOS is reporting 37 devices and i can see the power consumption. I guess i just had to wait 3 hours... Only issue now is that i left the configuration as is from the instructions intending to go in and change the clamp IDs etc. so now its working, but now am going to have to pull it all the way apart to be able to change settings?

@cdavis289
Copy link

okay Im not sure whats going on. Now HAOS is reporting 37 devices and i can see the power consumption. I guess i just had to wait 3 hours... Only issue now is that i left the configuration as is from the instructions intending to go in and change the clamp IDs etc. so now its working, but now am going to have to pull it all the way apart to be able to change settings?

You don’t need to remove it from the panel or take it apart. You can setup esphome on windows and update the config OTA.

@wbarber69
Copy link

Still no log output though. the esphome integration is showing active details, but no logs are viewable from esphome, just keeps timing out!!! wth?

@wbarber69
Copy link

okay Im not sure whats going on. Now HAOS is reporting 37 devices and i can see the power consumption. I guess i just had to wait 3 hours... Only issue now is that i left the configuration as is from the instructions intending to go in and change the clamp IDs etc. so now its working, but now am going to have to pull it all the way apart to be able to change settings?

You don’t need to remove it from the panel or take it apart. You can setup esphome on windows and update the config OTA.

yeah i wouldnt be complaining if that was an option. it also times out trying to connect.

@flaviut
Copy link
Author

flaviut commented Jul 17, 2022

@wbarber69 is the antenna fully screwed on? Is it fully inserted into the pcb? Is the antenna sticking out a side of the panel box that has the fewest wires (nearby wires interfere)? What happens if you move an access point closer to your panel?

@wbarber69
Copy link

the antenna is fine. the device is relaying information to HAOS but i cannot initiate a log output from ephome. I cannot do an ota update either through haos or esphome on windows, as it simply times out.

@wbarber69
Copy link

nevermind..... it was a stupid typo

@wbarber69
Copy link

well thanks guys, even if it was my stupid mistake. Now onto cracking open and hacking esphome onto all my emporia plugs.....

@stratus-ss
Copy link

Does anyone know how to get Home Assistant's Grid Consumption to recognize total power coming in off the grid. I assume there is something I have to do with the Vue template. Currently total power is set like this (I believe this is from the example)

 - platform: template
    name: "Total Power"
    lambda: return id(phase_a_power).state + id(phase_b_power).state;
    update_interval: 1s
    id: total_power
    unit_of_measurement: "W"

Does this have to be Wh?

@flaviut
Copy link
Author

flaviut commented Jul 26, 2022

Power is in watts, energy is in watt-hours or joules. Take a look at and use total_daily_energy, the next entry down.

I can't remember how I configured homeassistant, but everything you need should be in there--I have the exact same config, with a few numbers and names switched around.

@cdavis289
Copy link

cdavis289 commented Jul 26, 2022

Here is my code. You need to first get total power and then you use the total daily energy platform.

- platform: template
    name: "${friendly_devicename}: Total Power"
    lambda: return id(${devicename_no_dashes}_phase_a_power).state + id(${devicename_no_dashes}_phase_b_power).state;
    update_interval: 1s
    id: "${devicename_no_dashes}_total_power"
    unit_of_measurement: "W"
  
  - platform: total_daily_energy
    name: "${friendly_devicename}: Total Daily Energy"
    power_id: "${devicename_no_dashes}_total_power"
    accuracy_decimals: 0

@stratus-ss
Copy link

thanks @cdavis289 and @flaviut I appreciate what you both do to help this project!

@hiveai
Copy link

hiveai commented Jul 28, 2022

What is the recommended config for an unused input on the emporia vue2? I have some unused inputs that are showing values that are jumping all around (e.g. 0W->8W->24W->0W). How can I configure these Emporia inputs as unused and zero them out?

@flaviut
Copy link
Author

flaviut commented Jul 28, 2022

@hiveai delete their lines in the config and remove the places they're referenced from

@hiveai
Copy link

hiveai commented Jul 29, 2022

@flaviut and other contributors: Thanks for this great project and documentation! I have the vue2 flashed with custom ESPHome code and it working.
Is there a pointer to the recommended way to integrate the data into the energy dashboard in home assistant? I can bring up the device under ESPHome and see the power usage, but I'm not clear on how to configure Home Assistant to use this as a data source for energy monitoring.

@cdavis289
Copy link

Settings -> Dashboards -> Energy -> Electricity Grid (left side) -> Add Consumption or Add device

Select Emporia Vue Circuit Daily Energy Entities or Total Daily Energy.

I like to add each circuit to the consumption. Home assistant will stack the entities in the bar chart so you can get a visual of which circuit uses the most energy. You can also add them to the devices to see a comparison. Just depends on your preference.

@hiveai
Copy link

hiveai commented Jul 29, 2022

@cdavis289 Thanks! That's the info I needed. Looking up in the other comments I see that some folks are using MQTT for integration. Is that in addition to adding devices to the energy dashboard, or instead of the energy dashboard integration. What does MQTT integration of the ESPHome Vue2 get you? I apologize for these basic questions, but looking at the documentation and previous Comments/Q&A it's not clear to me.

@flaviut
Copy link
Author

flaviut commented Jul 29, 2022 via email

@dcorwin8222
Copy link

dcorwin8222 commented Jul 31, 2022 via email

@flaviut
Copy link
Author

flaviut commented Jul 31, 2022

@Jens5395
Copy link

Jens5395 commented Aug 5, 2022

If I upload the bare stub that is generated when a new device is added to ESPHome, should the Emporia connect to wifi? I can't upload the full configuration because it won't compile on the pi4 so I was hoping to maybe do the full configuration over the air once the Emporia is connected to the network. Right now I am dead in the water :(

@flaviut
Copy link
Author

flaviut commented Aug 5, 2022 via email

@Jens5395
Copy link

Jens5395 commented Aug 6, 2022

What's a 'regular computer'? LOL
Anyway, things have progressed substantially from my earlier post. The stub uploads and programs just fine and if you supply enough juice, the emporia does connect to the wifi network. I had to hook up line power to the emporia to make it run.
I tried everything I could think of to upload the required configuration but of course because of the lack of the required tool chain, that got me nowhere :(.
I have now set up an ubuntu laptop with ESPHome and ESPHome dashboard (no Home Assistant) and I got the configuration to compile! now my problem is 'how do I get the magic file that compiled onto the emporia which is wifi connected to the emporia'.. Unfortunately the upload via wifi fails and the ESPHome program will not recognize my serial port to do a wired transfer.
I am also working on some network issues because even though Ubiquity reports the empora to be on line, I can not ping it (although pings might not be allowed in ESPHome.
More research is required!

@flaviut
Copy link
Author

flaviut commented Aug 6, 2022

I'm pretty sure something weird is going on with your wifi, ping works fine for me:

$ ping emporiavue2.lan
PING emporiavue2.lan (192.168.86.144) 56(84) bytes of data.
64 bytes from emporiavue2.lan (192.168.86.144): icmp_seq=1 ttl=255 time=114 ms
64 bytes from emporiavue2.lan (192.168.86.144): icmp_seq=2 ttl=255 time=17.5 ms
64 bytes from emporiavue2.lan (192.168.86.144): icmp_seq=3 ttl=255 time=55.1 ms

anyway, now that you've compiled the file, you can transfer the .bin file over to the Pi, where presumably you had a working serial connection. Something like esptool.py --port /dev/ttyUSB0 write_flash 0x0 emporiavue2.bin should work.

@Jens5395
Copy link

Jens5395 commented Aug 6, 2022

Unfortunately, I am giving up for now.
I am now able to send a configuration from my secondary (non pi4) computer to the emporia but I am now getting a butt load of linking errors during the compile which I do not know how to deal with.
Note that I DO NOT HAVE the full Home Assistant installed on this computer. I only installed ESPHome and ESPHome dashboard. I suspect that some of te stuff that is being complained about relates to the HA not being installed.
Here is a shortened version that shows the beginning of the compile followed by a tiny portion of the linking errors (everything after the line that starts with "linking...." is an error message:

INFO Reading configuration config/emporia-01.yaml...
INFO Detected timezone 'America/Vancouver'
INFO Generating C++ source...
INFO Compiling app...
Processing emporia-01 (board: esp32dev; framework: espidf; platform: platformio/espressif32 @ 3.5.0)

HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash

  • framework-espidf @ 3.40302.0 (4.3.2)
  • tool-cmake @ 3.16.4
  • tool-ninja @ 1.7.1
  • toolchain-riscv32-esp @ 8.4.0+2021r2-patch2
  • toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch2
  • toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch2
    Reading CMake configuration...
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    No dependencies
    Linking .pioenvs/emporia-01/firmware.elf
    /home/jens/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/emporia-01/src/esphome/components/api/api_connection.o:(.literal._ZN7esphome3api13APIConnection17send_sensor_stateEPNS_6sensor6SensorEf+0xc): undefined reference to esphome::sensor::Sensor::has_state() const' /home/jens/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/emporia-01/src/esphome/components/api/api_connection.o:(.literal._ZN7esphome3api13APIConnection16send_sensor_infoEPNS_6sensor6SensorE+0x10): undefined reference to esphome::sensor::Sensor::get_unit_of_measurementabi:cxx11'
    /home/jens/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/emporia-01/src/esphome/components/api/api_connection.o:(.literal._ZN7esphome3api13APIConnection16send_sensor_infoEPNS_6sensor6SensorE+0x14): undefined reference to `esphome::sensor::Sensor::get_accuracy_decimals()'

@Jens5395
Copy link

Jens5395 commented Aug 7, 2022

Final entry:

For reasons unknown to me, the Emporia configuration compiled, was installed wireless and seems to function. There was a computer reboot involved so that might have fixed whatever was causing the compile errors.
To sum it up, a pi4 64 bit HA server configuration can not compile the Emporia Vue 2 configuration via ESPHome. It can however generate a configuration stub that, once uploaded to the emporia with a wired connection, will allow the emporia to connect to the network via wifi.
Now that the Emporia is on line, the Emporia configuration can be built. This is done, in my case, on a Ubuntu machine that runs an Intel processor and has the required tool chains available.
I installed ESPHome and ESPHome dashboard on my computer (the one wit the Intel processor). Note that there was only ESPHome installed and no Home Assistant files/system. I started up ESPHome, went to the dashboard (btw, you can also do this without the dashboard and I think I read that the dashboard only works on Linux) and generated a new stub for the Emporia. I then copied the configuration as shown in the article here into the stub, over-writing the temporary stub (it was just a place holder). I adjusted the wifi parameters for my setup. There are a couple of gotcha's here. My normal esphome configuration files use !secrets for the ssid and password. This will not work because we are compiling on a computer that does not have these HA options available. The ssid and password must be hard coded into the configuration. I also had to set up static IP parameters in the configuration in order to make this work .... although I can't recall the exact reason. All my esphome devices have static IP's set up in the router so hardcoding a static IP in the configuration might not be required. YMMV.
So, we have an Emporia device that is on the network and we have a configuration file set up on the Intel computer. All that is required now is to install the new configuration to the Emporia.
If all goes as planned (and not like in my case), the configuration will be compiled, uploaded to the Emporia that is on line already and when finished, the Emporia will reboot and spew out all kinds of data which will be captured in the Home Assistant system running on the Pi4.
When you set up the hard coded credentials, please note that the SSIDS field is case sensitive. I new this was so for the password but did not realize that this was the case for the SSID. That error took me WAY too long to find!
I hope that this might help future HA builders to set up an Emporia device without all the crap I went through .....

@Jens5395
Copy link

Jens5395 commented Aug 7, 2022

The instructions for the Emporia indicate that it doesn't matter which of the three 200A circuits you plug into. I am in North America so there are two 200A clamps and it does indeed matter how they are connected to the Emporia. With the configuration script shown in this article, one needs to use inputs A and B.
Yes I know they are called A and B in the configuration but I didn't make the connection ....
While the instructions allude to the fact that you need to keep the legs sorted, I would like to stress that it is important not only for the current clamps but also how you hook up power to the Emporia. If the power leads to the emporia do not not match which 200A clamp is on what leg, readings might be wrong or you might have no readings at all. The black Emporia power wire needs to be on the same power distribution leg that has current clamp A on it. The red power wire needs to be on the same power leg as the clamp that feeds input B.

@Jens5395
Copy link

Jens5395 commented Aug 7, 2022

How does HA know when to reset daily energy numbers? My new install doesn't seem to reset at midnight.

@flaviut
Copy link
Author

flaviut commented Aug 7, 2022 via email

@flaviut
Copy link
Author

flaviut commented Aug 7, 2022 via email

@clowrey
Copy link

clowrey commented Aug 8, 2022

Thanks for all the work getting this working!! I spent about 5 hours thinking there was some way I could get it to compile on a raspberry pi 4 with 4gb ram- including switching to the 32bit version, but it still wont work.. So in the end I relented and am now running home assistant on a 7 year old i3 intel NUC and it works great!! I definitely recommend anyone wanting to use this currently in a standalone installation to just buy a used intel NUC for < $100 on ebay and be done with it... Going to try get it working with three phase inputs some time soon, not sure how hard/easy that will be.

EDIT > looks like it works with three phase just by adding in phase C in the config file! awesome!

@Jens5395
Copy link

Jens5395 commented Aug 8, 2022

I spent way too many hours on this ... but in the end, my method works great and I still have my original Pi4 running HA.

@clowrey
Copy link

clowrey commented Aug 8, 2022

I spent way too many hours on this ... but in the end, my method works great and I still have my original Pi4 running HA.

But can you change the ESPhome settings from the RPI4? that is my main reason, I anticipate needing to re-compile and update, and will have remote systems running this etc..

Edit > I'm not saying one method is better than the other, just saying for me this is overall easier and more maintainable, at least until we can compile it on ARM..

@Jens5395
Copy link

Jens5395 commented Aug 8, 2022

No, I would not be able to change the configuration from the Pi4 .... that would require a recompile which can't be done from the Pi4.
I installed ESPHome and the dashboard on one of my laptops. It just sits there ready for use. If I need to recompile, I just start up ESPHome, go to the dashboard, load te configuration file, tweak it and send it back to the Emporia - no muss, no fuss, I just have to remember to do it via Chrome instead of my normal browser (Thunderbird).
I recompiled a whole bunch of times as I was setting everything up so yes, you absolutely need to be able to recompile and send te result to the Emporia. I am still working out a couple of issues and expect that I am not finished configuring things.
BTW, I did not try generating the .bin file on my laptop, transfer it to the pi and then send it to the Emporia. That should (in theory) work but it's an extra step that is not really required.

@Jens5395
Copy link

Jens5395 commented Aug 9, 2022

Does anybody else have issues with 'daily energy' never resetting at the end of the day?
I did need to set my own sntp server (network doesn't allow traffic to the outside) but that didn't help. Looking at the logs from the Emporia, every message has the correct time in front of it.
Let me clarify this a bit - if I look at the 'energy' dashboard, the daily energy is correct. I have an 'entities' card set up in one of my dashboard views and it shows individual circuits and individual daily power usage (and total daily power usage). It is those totals sensors that do not reset.
Platfom 'Total Daily Energy Sensor' states:

# Enable time component to reset energy at midnight
time:
  - platform: sntp
    id: my_time

From what I can tell, the time platform is working as every single status message from the Emporia has the correct time stamp .... but maybe that time component is different from the time that shows up in the logs - how do I check if id: my_time is correct? my_time is not an entity or a helper so how can I verify it?

@mgulick
Copy link

mgulick commented Aug 9, 2022

Does anybody else have issues with 'daily energy' never resetting at the end of the day?

My daily energy value also did not reset at first. I don't know exactly what I did to fix it. It may have started working on its own at some point after a few days or maybe a week. I do remember that I changed the time platform from sntp to:

time:
  - platform: homeassistant
    id: homeassistant_time

This is working fine for me and is syncing time via home assistant. I have my emporia vue 2 on an isolated VLAN which doesn't have internet access, so sntp probably wasn't working (my DHCP server hands out local ntp server info, but I think most devices ignore that).

@Jens5395
Copy link

Jens5395 commented Aug 9, 2022

Thanks for that mgulick. I tried that this morning but this gives me a compile error which is likely due to me having to compile the Emporia configuration on a computer other than the computer running HA.
It is good to know I am not the only person that has/had daily reset issues.

*** [.pioenvs/emporia-01/src/esphome/components/sntp/sntp_component.o] Source `src/esphome/components/sntp/sntp_component.cpp' not found, needed by target `.pioenvs/emporia-01/src/esphome/components/sntp/sntp_component.o'.

@stephenjamieson
Copy link

Is there another location, discord or an issue somewhere, that these things can be discussed. I'm honestly watching this gist in case there are changes or issues with the integration itself.

@clowrey
Copy link

clowrey commented Aug 9, 2022

You could just watch the Integration source repository that is linked to in the example configuration. Not sure where else to discuss issues as there is no issue tracker?

changes or issues with the integration itself.

@mgulick
Copy link

mgulick commented Aug 9, 2022

@Jens5395, I would frequently have compile errors when rebuilding after making changes to the configuration. Cleaning the build artifacts usually resolved the issue. It looks like this option is called "Clean Build Files" from the ESPHome dashboard (https://esphome.io/guides/getting_started_hassio.html) and esphome clean <config> from the ESPHome CLI (https://esphome.io/guides/cli.html#clean-command).

@Jens5395
Copy link

Jens5395 commented Aug 9, 2022

Ha!!!! That did the trick, it compiled! Now to see if it fixes things at midnight ....
Thanks!

@stephenjamieson
Copy link

@clowrey sure, my point is that these issues are not related to the Emporia Vue.

@flaviut
Copy link
Author

flaviut commented Aug 9, 2022

Please keep all discussion here

Hey y'all, I've had my own gripes with Gist as a discussion platform as well.

Any further comments here will be deleted and recreated in https://github.com/emporia-vue-local/esphome/discussions. This will be the last comment on this gist.

@doronazl
Copy link

@rjchu, Yes mqtt is working quite well - I use FHEM (https://fhem.de/) hence mqtt is my choice of integration in this case.

Btw, unlike the emporia app which only calculates apparent power on the 16 CTs, this implementation is correctly measuring real power - thank you @flaviut !

sudo docker run --rm -v "${PWD}":/config -it esphome/esphome version
Version: 2022.6.0

here is my draft config - still making design decisions but working quite well already. the send times are temporarily set too low, I plan on every 10 secs for instant and every 5 mins for totals, etc

esphome:
  name: emporiavue2

external_components:
  - source: github://flaviut/esphome@emporia-vue-2022.4.0
    components: [ emporia_vue ]

esp32:
  board: esp32dev
  framework:
    type: esp-idf
    version: recommended

# Enable Home Assistant API
#api: {"password": "<ota password>"}
ota: {"password": "<xyz>"}

# Enable logging
logger:
  level: WARN

wifi:
  ssid: "myssid"
  password: "mypassword"

mqtt:
  broker: 1.2.3.4
  client_id: vue2
  username: myuser
  password: mypassword
  port: 1883
  topic_prefix: vue2
  discovery: false
  log_topic: null


i2c:
  sda: 21
  scl: 22
  scan: false
  frequency: 200kHz  # recommended range is 50-200kHz
  id: i2c_a

# these are called references in YAML. They allow you to reuse
# this configuration in each sensor, while only defining it once
.defaultfilters:
  - &moving_avg
    # we capture a new sample every 0.24 seconds, so the time can
    # be calculated from the number of samples as n * 0.24.
    sliding_window_moving_average:
      # we average over the past 2.88 seconds
      window_size: 12
      # we push a new value every 1.44 seconds
      send_every: 6
  - &invert
    # invert and filter out any values below 0.
    lambda: 'return max(-x, 0.0f);'
  - &pos
    # filter out any values below 0.
    lambda: 'return max(x, 0.0f);'
  - &abs
    # take the absolute value of the value
    lambda: 'return abs(x);'

sensor:
  - platform: emporia_vue
    i2c_id: i2c_a
    phases:
      - id: phase_a  # Verify that this specific phase/leg is connected to correct input wire color on device listed below
        input: BLACK  # Vue device wire color
        calibration: 0.0229  # 0.022 is used as the default as starting point but may need adjusted to ensure accuracy
        # To calculate new calibration value use the formula <in-use calibration value> * <accurate voltage> / <reporting voltage>
        voltage:
          name: "Phase A Voltage"
          internal: true
          id: phase_a_voltage
          filters: [*moving_avg, *pos]
      - id: phase_b  # Verify that this specific phase/leg is connected to correct input wire color on device listed below
        input: RED  # Vue device wire color
        calibration: 0.022  # 0.022 is used as the default as starting point but may need adjusted to ensure accuracy
        # To calculate new calibration value use the formula <in-use calibration value> * <accurate voltage> / <reporting voltage>
        voltage:
          name: "Phase B Voltage"
          internal: true
          id: phase_b_voltage
          filters: [*moving_avg, *pos]
      - id: phase_c  # Verify that this specific phase/leg is connected to correct input wire color on device listed below
        input: BLUE  # Vue device wire color
        calibration: 0.022193  # 0.022 is used as the default as starting point but may need adjusted to ensure accuracy
        # To calculate new calibration value use the formula <in-use calibration value> * <accurate voltage> / <reporting voltage>
        voltage:
          internal: true
          name: "Phase C Voltage"
          id: phase_c_voltage
          filters: [*moving_avg, *pos]
    ct_clamps:
      - phase_id: phase_a
        input: "A"  # Verify the CT going to this device input also matches the phase/leg
        power:
          name: "Phase A Power"
          internal: true
          id: phase_a_power
          device_class: power
          filters: [*moving_avg, *pos]
      - phase_id: phase_b
        input: "B"  # Verify the CT going to this device input also matches the phase/leg
        power:
          name: "Phase B Power"
          internal: true
          id: phase_b_power
          device_class: power
          filters: [*moving_avg, *pos]
      - phase_id: phase_c
        input: "C"  # Verify the CT going to this device input also matches the phase/leg
        power:
          name: "Phase C Power"
          internal: true
          id: phase_c_power
          device_class: power
          filters: [*moving_avg, *pos]
      # Pay close attention to set the phase_id for each breaker by matching it to the phase/leg it connects to in the panel
      - { phase_id: phase_b, input:  "1", power: { name: "Front Steps (Camera, Lights)",                            internal: true, id:  cir1, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_b, input:  "2", power: { name: "Kitchen Left (Fridge, Oven, Microwave)",                  internal: true, id:  cir2, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_b, input:  "3", power: { name: "Kitchen Right (Dishwasher, Coffee Machine)",              internal: true, id:  cir3, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_b, input:  "4", power: { name: "4 ??",                                                       internal: true, id:  cir4, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_c, input:  "5", power: { name: "Kitchen Stove",                                           internal: true, id:  cir5, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_b, input:  "6", power: { name: "Downstairs Right (Study, Hall, Bathroom, Guest, Server)", internal: true, id:  cir6, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_c, input:  "7", power: { name: "Downstairs Left (Living, Dining Room)",                   internal: true, id:  cir7, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_b, input:  "8", power: { name: "Upstairs (Master Bedroom)",                               internal: true, id:  cir8, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_a, input:  "9", power: { name: "Upstairs (incl. Attic lights, except Master Bedroom)",    internal: true, id:  cir9, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_c, input: "10", power: { name: "Cellar, Washing Room, Power Room (incl. Freezer)",        internal: true, id: cir10, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_a, input: "11", power: { name: "Doorbell",                                                internal: true, id: cir11, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_a, input: "12", power: { name: "Shutters",                                                internal: true, id: cir12, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_a, input: "13", power: { name: "Cellar (Dryer, Washer)",                                  internal: true, id: cir13, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_a, input: "14", power: { name: "Cellar Right, Workshop Play Room, Heating Room",          internal: true, id: cir14, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_a, input: "15", power: { name: "Outdoors Lights",                                         internal: true, id: cir15, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_a, input: "16", power: { name: "Cellar Left, Washing Room (Plants Lights, Garage)",       internal: true, id: cir16, filters: [ *moving_avg, *pos ] } }





  - platform: template
    internal: true
    name: "Total Circuits Power"
    lambda: return id(cir1).state + id(cir2).state + id(cir3).state + id(cir4).state + id(cir5).state
      + id(cir6).state + id(cir7).state + id(cir8).state + id(cir9).state + id(cir10).state
      + id(cir11).state + id(cir12).state + id(cir13).state + id(cir14).state + id(cir15).state + id(cir16).state;
    update_interval: 1s
    id: total_power_circuits
    unit_of_measurement: "W"
  - platform: template
    internal: true
    name: "Total Power"
    lambda: return id(phase_a_power).state + id(phase_b_power).state + id(phase_c_power).state;
    update_interval: 1s
    id: total_power
    unit_of_measurement: "W"
  - platform: total_daily_energy
    name: "Total Daily Energy"
    internal: true
    power_id: total_power
    id: total_daily_power
    accuracy_decimals: 0
    min_save_interval: 10s
    unit_of_measurement: "W"
  - { power_id:  cir1, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir1 }
  - { power_id:  cir2, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir2 }
  - { power_id:  cir3, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir3 }
  - { power_id:  cir4, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir4 }
  - { power_id:  cir5, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir5 }
  - { power_id:  cir6, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir6 }
  - { power_id:  cir7, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir7 }
  - { power_id:  cir8, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir8 }
  - { power_id:  cir9, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir9 }
  - { power_id: cir10, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir10 }
  - { power_id: cir11, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir11 }
  - { power_id: cir12, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir12 }
  - { power_id: cir13, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir13 }
  - { power_id: cir14, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir14 }
  - { power_id: cir15, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir15 }
  - { power_id: cir16, platform: total_daily_energy, accuracy_decimals: 0, internal: true, id: total_daily_power_cir16 }

time:
  - platform: sntp
    id: my_time
    timezone: Europe/Berlin
    servers: 
      - 192.168.178.99
      - 0.pool.ntp.org
      - 1.pool.ntp.org
    on_time_sync:
      then:
        - logger.log: "Synchronized system clock"
    on_time:
      - seconds: /10
        then:
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir01_power");
              payload: !lambda |-
                return to_string(id(cir1).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir02_power");
              payload: !lambda |-
                return to_string(id(cir2).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir03_power");
              payload: !lambda |-
                return to_string(id(cir3).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir04_power");
              payload: !lambda |-
                return to_string(id(cir4).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir05_power");
              payload: !lambda |-
                return to_string(id(cir5).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir06_power");
              payload: !lambda |-
                return to_string(id(cir6).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir07_power");
              payload: !lambda |-
                return to_string(id(cir7).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir08_power");
              payload: !lambda |-
                return to_string(id(cir8).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir09_power");
              payload: !lambda |-
                return to_string(id(cir9).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir10_power");
              payload: !lambda |-
                return to_string(id(cir10).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir11_power");
              payload: !lambda |-
                return to_string(id(cir11).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir12_power");
              payload: !lambda |-
                return to_string(id(cir12).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir13_power");
              payload: !lambda |-
                return to_string(id(cir13).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir14_power");
              payload: !lambda |-
                return to_string(id(cir14).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir15_power");
              payload: !lambda |-
                return to_string(id(cir15).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir16_power");
              payload: !lambda |-
                return to_string(id(cir16).state);
          - mqtt.publish:
              topic: "vue2/circuits/total_power_circuits"
              payload: !lambda |-
                return to_string(id(total_power_circuits).state);
          - mqtt.publish:
              topic: "vue2/mains/total/total_power"
              payload: !lambda |-
                return to_string(id(total_power).state);

      - seconds: /10
        then:
          - mqtt.publish:
              topic: "vue2/mains/phase_a_voltage"
              payload: !lambda |-
                return to_string(id(phase_a_voltage).state);
          - mqtt.publish:
              topic: "vue2/mains/phase_b_voltage"
              payload: !lambda |-
                return to_string(id(phase_b_voltage).state);
          - mqtt.publish:
              topic: "vue2/mains/phase_c_voltage"
              payload: !lambda |-
                return to_string(id(phase_c_voltage).state);
          - mqtt.publish:
              topic: "vue2/mains/phase_a_power"
              payload: !lambda |-
                return to_string(id(phase_a_power).state);
          - mqtt.publish:
              topic: "vue2/mains/phase_b_power"
              payload: !lambda |-
                return to_string(id(phase_b_power).state);
          - mqtt.publish:
              topic: "vue2/mains/phase_c_power"
              payload: !lambda |-
                return to_string(id(phase_c_power).state);

      - seconds: 0
        minutes: /5
        then:
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir01_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir1).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir02_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir2).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir03_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir3).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir04_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir4).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir05_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir5).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir06_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir6).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir07_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir7).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir08_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir8).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir09_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir9).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir10_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir10).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir11_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir11).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir12_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir12).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir13_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir13).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir14_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir14).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir15_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir15).state);
          - mqtt.publish:
              topic: !lambda |-
                return std::string("vue2/circuits/cir16_total_daily_power");
              payload: !lambda |-
                return to_string(id(total_daily_power_cir16).state);


      - seconds: 0
        minutes: /5
        then:
          - mqtt.publish:
              topic: "vue2/mains/total/total_daily_power"
              payload: !lambda |-
                return to_string(id(total_daily_power).state);

      - seconds: 0
        minutes: /10
        then:
          - mqtt.publish:
              topic: "vue2/circuits/cir01_name"
              payload: !lambda |-
                return id(cir1).get_name();
          - mqtt.publish:
              topic: "vue2/circuits/cir02_name"
              payload: !lambda |-
                return id(cir2).get_name();
          - mqtt.publish:
              topic: "vue2/circuits/cir03_name"
              payload: !lambda |-
                return id(cir3).get_name();
          - mqtt.publish:
              topic: "vue2/circuits/cir04_name"
              payload: !lambda |-
                return id(cir4).get_name();
          - mqtt.publish:
              topic: "vue2/circuits/cir05_name"
              payload: !lambda |-
                return id(cir5).get_name();
          - mqtt.publish:
              topic: "vue2/circuits/cir06_name"
              payload: !lambda |-
                return id(cir6).get_name();
          - mqtt.publish:
              topic: "vue2/circuits/cir07_name"
              payload: !lambda |-
                return id(cir7).get_name();
          - mqtt.publish:
              topic: "vue2/circuits/cir08_name"
              payload: !lambda |-
                return id(cir8).get_name();
          - mqtt.publish:
              topic: "vue2/circuits/cir09_name"
              payload: !lambda |-
                return id(cir9).get_name();
          - mqtt.publish:
              topic: "vue2/circuits/cir10_name"
              payload: !lambda |-
                return id(cir10).get_name();
          - mqtt.publish:
              topic: "vue2/circuits/cir11_name"
              payload: !lambda |-
                return id(cir11).get_name();
          - mqtt.publish:
              topic: "vue2/circuits/cir12_name"
              payload: !lambda |-
                return id(cir12).get_name();
          - mqtt.publish:
              topic: "vue2/circuits/cir13_name"
              payload: !lambda |-
                return id(cir13).get_name();
          - mqtt.publish:
              topic: "vue2/circuits/cir14_name"
              payload: !lambda |-
                return id(cir14).get_name();
          - mqtt.publish:
              topic: "vue2/circuits/cir15_name"
              payload: !lambda |-
                return id(cir15).get_name();
          - mqtt.publish:
              topic: "vue2/circuits/cir16_name"
              payload: !lambda |-
                return id(cir16).get_name();

Hi. How is your setup working with 3 phase?
Just bought a couple of emporia and noticed the yaml is setup for 2 phase, not 3.

@cangaroo82
Copy link

Good morning
VUE 2 modified with ESPHOME.
same as VUE2.yaml. on home assistant virtual machine works well.
on ihost modified Home assistant returns:

`- Configuring incomplete, errors occurred!
See also "/data/build/vue2-1/.pioenvs/vue2-1/CMakeFiles/CMakeOutput.log".
See also "/data/build/vue2-1/.pioenvs/vue2-1/CMakeFiles/CMakeError.log".

fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
CMake Error at /data/cache/platformio/packages/tool-cmake/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

"/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /data/build/vue2-1/.pioenvs/vue2-1/CMakeFiles/CMakeTmp

Run Build Command(s):/data/cache/platformio/packages/tool-ninja/ninja cmTC_22cff && [1/2] Building C object CMakeFiles/cmTC_22cff.dir/testCCompiler.c.obj
[2/2] Linking C executable cmTC_22cff
FAILED: cmTC_22cff 
: && /data/cache/platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc -mlongcalls -Wno-frame-address   CMakeFiles/cmTC_22cff.dir/testCCompiler.c.obj  -o cmTC_22cff   && :
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../libexec/gcc/xtensa-esp32-elf/8.4.0/liblto_plugin.so: error loading plugin: /data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../libexec/gcc/xtensa-esp32-elf/8.4.0/liblto_plugin.so: cannot open shared object file: No such file or directory
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
/data/cache/platformio/packages/framework-espidf/tools/cmake/project.cmake:298 (__project)
CMakeLists.txt:3 (project)

========================= [FAILED] Took 26.35 seconds =========================`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment