Last active
May 22, 2022 02:07
-
-
Save georgeh/0c4d27f30c2c04cbbc81f9d193f6cfc8 to your computer and use it in GitHub Desktop.
DTE Insight Home Assistant configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sensor: | |
# Read in DTE Insight via MQTT. You can add an MQTT integration in Home Assistant with the DTE Insight's IP address on port 2883 | |
- platform: mqtt # this is my DTE Insight, if you have multiple MQTT servers this might be different | |
name: Instant Energy Usage | |
state_topic: "event/metering/instantaneous_demand" | |
unit_of_measurement: W | |
value_template: "{{ value_json.demand }}" | |
state_class: measurement | |
device_class: energy | |
# These convert the template sensors below from Watts to Kilowatt-hours using the power of calculus | |
- platform: integration | |
source: sensor.grid_electric_usage | |
name: DTE Energy Usage | |
unit_prefix: k | |
- platform: integration | |
source: sensor.grid_electric_return | |
name: DTE Energy Return | |
unit_prefix: k | |
template: | |
- sensor: | |
# Calculate the household electric usage by adding the DTE Insight measurement with the solar measurement | |
- name: "Grid Electric Usage" | |
unit_of_measurement: W | |
state_class: measurement | |
device_class: power | |
state: > | |
{% set dte_watts = states('sensor.instant_energy_usage' ) | int %} | |
{% set solar_watts = states('sensor.envoy_202119015431_current_power_production' ) | int %} | |
{{ dte_watts + solar_watts }} | |
# Calculate the electricity that is returned to the grid by only using the DTE Insight value when it is negative | |
- name: "Grid Electric Return" | |
unit_of_measurement: W | |
state_class: measurement | |
device_class: power | |
state: > | |
{% set dte_watts = states('sensor.instant_energy_usage' ) | int %} | |
{% if dte_watts < 0 %} | |
{{ 0 - dte_watts }} | |
{% else %} | |
0 | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
well I have this if you need it at some point: