vk2him / Enphase-Envoy-mqtt-json

Takes real time stream from Enphase Envoy and publishes to mqtt broker
MIT License
55 stars 23 forks source link

How to get production from v7/v8 FW #29

Closed PertuyF closed 7 months ago

PertuyF commented 9 months ago

Hey there,

Thanks a ton for this work, I am learning a lot! I am looking for a fine-grained measurement to monitor power flows from my installation, and this looks really close to my needs.

One thing that is not obvious to me, though, and I hope you could help. With V5 firmware it looks like there is a dedicated section for production and consumption and net power. For V7/V8 firmware, I don't understand how production is represented. Could someone help me with that?

Best, Fabien

vk2him commented 9 months ago

Hi, Thanks for using the addon.

There's an excellent writeup here by @del13r about what the V7 values mean and he may be able to assist: https://community.home-assistant.io/t/enphase-envoy-d7-firmware-with-jwt-a-different-approach/594082

@helderfmf wrote the v7 section of this addon code - he may be able to assist with the specifics of templates that may be needed for Home Assistant? Thanks

PertuyF commented 9 months ago

Oh, OK, got it. I've got confused about what the fields are about in the JSON. Field 0 is production, field 1 is consumption. It all makes better sense now!

I'll be able to sort everything out, thank you!

alexeiw123 commented 6 months ago

Just in case others come looking for a solution to the same problem:

mqtt:
  sensor:
    - name: "mqtt_net"
      state_topic: "/envoy/json"
      unit_of_measurement: "W"
      qos: 0
      state_class: measurement
      device_class: power
      value_template: '{{ value_json[1]["activePower"] | round(0) | int(0) }}'

    - name: "mqtt_production"
      state_topic: "/envoy/json"
      qos: 0
      unit_of_measurement: "W"
      value_template: '{{ value_json[0]["activePower"] | round(0) | int(0)}}'
      state_class: measurement
      device_class: power

    - name: "mqtt_consumption"
      state_topic: "/envoy/json"
      unit_of_measurement: "W"
      qos: 0
      state_class: measurement
      device_class: power
      value_template: '{{ ( value_json[1]["activePower"] + value_json[0]["activePower"] ) | round(0) | int(0) }}' # Net + production