Thank you once again
FYi - I had issues with this just now and found the the correct syntax is:
update "statistics_meta"
set unit_of_measurement = "kWh"
where id = "25"
Maybe it didn’t like the mixed single and double quotes?
Curious, I am playing with my Enphase now, and I noticed that my results are updating every 1 or so minutes on HA. I have seen that a few people are able to get updates every 1 second. I was wondering how to do that… I tried checking the Enphase site and calling them, but I have had no luck. I assume this is on the enphase side - not HA, but I was hoping someone might have an idea.
Ideally, I would like to see the consumption real time, so that we can determine how much each appliance is using in real time by turning it off and on. Of course, I can wait a minute each time, but it would be nicer if I could get an update every second.
Thank you
Yep, 1 second updates are able to be done via this script. I currently have this working myself.
The 1 second updates are currently only possible by running this script on a computer that has python. In my case I have a windows 10 computer that I leave on all the time where I just leave this python script running and it polls the envoy every second and then publishes the output to Home Assistant via the mqtt protocol.
The installer password was rather easy to decrypt too. Let us know if you need a hand as I just went through this myself.
See
Mentioned here
This is great… I will take a look. I am using a Windows 10 Hyper-V to run my instance of HA. So I can do the same. I tried to setup a installer account, which I was able to do, but I noticed that I could not access my enphase installer account. Enphase told me only the installer that setup the system has access… not just any installer. If you have a link to decrypt the installer credentials, that would be great too. This is an amazing thread and I am learning so much about HA and Enphase!
Here is how I got the installer password.
Went to http://envoy.local (top of screen)
Copied and pasted my serial number into serialnumber =
of passwordCalc.py (left of screen)
then I pressed Run / Run Module and it spits out the password in blue on the output (right of screen)
Next step is setting up MQTT broker (if not already using one)
Setup a user for mosquito and remember the password you make up for it.
Then install Mosquito broker Integration
- Navigate in your Home Assistant frontend to Supervisor → Add-on Store.
- Find the “Mosquitto broker” add-on and click it.
- Click on the “INSTALL” button.
Once we have the installer password, we can then edit the envoy_to_mqtt_json.py file and run it.
Then you can verify MQTT is working by listening to /envoy/json
go to configuration / mosquito mqtt broker / configure / listen to a topic
@del13r Genius Simply a genius. Thank you for this information. I was able to follow your instructions and get the data I was looking for… This is great!
I’m getting the following error in the HAS logs sometimes at startup (5 in succession):
Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/connection.py:89
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 16:45:31 (5 occurrences)
Last logged: 16:45:31
[281473253665088] Received invalid command: energy/info
Has anyone else seen this? My Energy dashboard seems to populate just fine…
Maybe this
I saw that, but I haven’t excluded anything from Recorder, and my Energy dashboard is populating just fine. Seems to only happen at HA startup, and not every time. Can anyone see if they have the same message in the logs?
Hi @vk2him,
Something about the visual layout of power wheel turned me off and I didn’t feel I could commit to it.
I have instead decided to go with the Tesla Style Solar Power Card as it sort of looks like the Energy Dashboard card.
Once installed, I used the following sensors in the card config.
type: custom:tesla-style-solar-power-card
# 3 flows between bubbles
grid_to_house_entity: sensor.mqtt_import_power
generation_to_grid_entity: sensor.mqtt_export_power
generation_to_house_entity: sensor.mqtt_consumption
# extra values to show as text above icons
grid_extra_entity: sensor.mqtt_instant_cost_per_hour
house_extra_entity: sensor.today_energy_total_cost
generation_extra_entity: sensor.temp
That’s an interesting looking display - I might try it out and see.
I have abandoned the Tesla style as I couldn’t read it easily from a distance
Hi @del13r. I’m thinking of trying out the mqtt setup to get some realtime info. What do you do with the realtime sensors? Do you only use them for a display like yours at https://community.home-assistant.io/t/enhpase-envoy-on-2021-8-with-new-energy-feature/328668/220, or have you integrated them with the energy dashboard stuff you’ve so lovingly developed?
Correct, only for realtime dashboard at the moment.
Ive turned off recorder for the mqtt sensors as I assume they would accumulate too much data too quickly.
I also just found that when my database file hits 3gb, problems start happening so I am in the process of identifying what’s important and what’s not for historical data.
Great, thank you. Would you mind posting your sensor and template yaml for the mqtt implementation? From your dashboard card examples, it looks like you use different names to the ones at https://github.com/vk2him/Enphase-Envoy-mqtt-json.
Oh, and how do you find out the database size? What sort of problems do you start to see at that size?
sensor:
- platform: mqtt
state_topic: "/envoy/json"
name: "mqtt_production"
unit_of_measurement: W
value_template: >
{% set value = value_json["production"]["ph-a"]["p"] | int %}
{% if value <= 5 -%}
0
{% elif is_state('sun.sun','below_horizon') %}
0
{%- else -%}
{{ value }}
{%- endif %}
state_class: measurement
device_class: power
- platform: mqtt
state_topic: "/envoy/json"
value_template: '{{ value_json["total-consumption"]["ph-a"]["p"] | int }}'
name: "mqtt_consumption"
unit_of_measurement: W
state_class: measurement
device_class: power
- platform: mqtt
state_topic: "/envoy/json"
name: "mqtt_power_factor"
unit_of_measurement: '%'
value_template: '{{ value_json["total-consumption"]["ph-a"]["pf"] }}'
state_class: measurement
device_class: power_factor
- platform: mqtt
state_topic: "/envoy/json"
name: "mqtt_voltage"
unit_of_measurement: V
value_template: '{{ value_json["total-consumption"]["ph-a"]["v"] | int }}'
state_class: measurement
device_class: voltage
recorder:
exclude:
entity_globs:
- sensor.mqtt_*
template:
- sensor:
name: MQTT_Import_Power
state_class: measurement
icon: mdi:transmission-tower
unit_of_measurement: W
device_class: power
state: >
{% set production = states('sensor.mqtt_production') | int %}
{% set consumption = states('sensor.mqtt_consumption') | int %}
{{ [0, (consumption - production) ] | max }}
- sensor:
name: MQTT_Export_Power
state_class: measurement
icon: mdi:transmission-tower
unit_of_measurement: W
device_class: power
state: >
{% set production = states('sensor.mqtt_production') | int %}
{% set consumption = states('sensor.mqtt_consumption') | int %}
{{ [0, (production - consumption) ] | max }}
views:
- path: default_view
title: Power
type: sidebar
badges: []
cards:
- type: horizontal-stack
cards:
- type: gauge
entity: sensor.mqtt_consumption
min: 0
max: 7500
severity:
green: 0
yellow: 0
red: 0
- type: gauge
min: 0
max: 7500
severity:
green: 1
yellow: 0
red: 0
entity: sensor.mqtt_production
- type: gauge
max: 5
entity: sensor.today_energy_total_cost
min: -1
severity:
green: 0
yellow: 2
red: 4
- type: horizontal-stack
cards:
- type: gauge
min: 0
max: 7500
entity: sensor.mqtt_import_power
severity:
green: 0
yellow: 0
red: 0
- type: gauge
entity: sensor.mqtt_export_power
min: 0
max: 7500
severity:
green: 1
yellow: 0
red: 0
- type: gauge
severity:
green: 0
yellow: 0.2
red: 0.4
max: 0.5
entity: sensor.mqtt_instant_cost_per_hour
min: -1
- type: entities
entities:
- entity: sensor.mqtt_voltage
- entity: sensor.mqtt_power_factor
I got bored with voltage and power factor so replaced them with costs instead and moved them further down.
as for the 3gb database limit, I just found that the history tab wouldnt load anymore.
To find the size, I already had sqlite web addon installed
Also, I used customize.yaml to rename the sensors
sensor.mqtt_consumption:
friendly_name: House Consumption
sensor.mqtt_production:
friendly_name: Solar Production
sensor.mqtt_export_power:
friendly_name: to the Grid
sensor.mqtt_import_power:
friendly_name: from the Grid
sensor.mqtt_instant_cost_per_hour:
friendly_name: Cost Per Hour
Amazingly helpful, as always! Why did you use customize.yaml, rather than naming the sensors like that in the first place?
I’m guessing there must be more to sensor.mqtt_instant_cost_per_hour
. Have you used the mqtt data to improve your previously posted cost sensors in some way? I may have missed a post somewhere if you’ve already explained that bit.
I have 3 phases on my system. I’d appreciate any help (from anyone) as to how to change the sensors to take that into account. I’m very new to all this!