It looks like there are a handful or so of similar topics on this subject but not many of them are recent, and the most recent ones are not helping much in getting this working for me.
I have a DTE Energy Bridge v2 with recent firmware that exposes current energy use over MQTT, here is an example of the output:
How do i get this into HomeAssistant for my Energy Dashboard? Id like to see the “demand” variable used in HomeAssistant to show my energy usage by the hour at the very least.
I’ve been experimenting with some different configuration.yaml settings from various old topics and github threads with no luck.
Apologies if my question is rather noob-ish, I’m only recently starting to get into integrating all of my smart appliances into my HomeAssistant instance and this type of integration is totally new to me. (This is actually the last of my devices i haven’t integrated yet)
Thank you in advance, any help would be greatly appreciated!
Do you have an MQTT broker already running on a different computer or device? Mosquitto can be used to bridge to the Energy Bridge MQTT broker either within the Mosquitto broker HA addon or via the mosquitto broker running on a different machine or device.
I have mosquitto running on my instance of haOS. I can see the energy bridge in MQTT explorer. I’m not understanding how to get it into Home Assistant.
Like the OP, I’m having no luck following old guides (as most of them have deprecated YAML examples)
Did you ever find a solution to getting this integrated? I see a lot of posts on here and Reddit with no actual solutions. This is the first one I seen with actual comments.
This is the yaml I have to read from mqtt that has been working for me for a while now including the latest release 2024.12:
mqtt:
sensor:
- name: "DTE Instantaneous Demand"
icon: mdi:transmission-tower
state_topic: "event/metering/instantaneous_demand"
unit_of_measurement: "W"
value_template: "{{ value_json.demand | default(0) | round(0) }}"
device_class: power
unique_id: dte_instantaneous_demand
- name: "DTE Energy Bridge"
icon: mdi:transmission-tower
unique_id: dteenergybridge
state_topic: "event/metering/summation/minute"
unit_of_measurement: "kWh"
# the Energy Bridge returns "Watt-minutes" every minute in the "value"; convert it to kilowatt-hours
value_template: "{{ value_json.value | float / 60000 }}"
# the "time" in the message is a Unix-like timestamp (in milliseconds) of the start of the last reading
last_reset_value_template: "{{ now().fromtimestamp(value_json.time / 1000).replace(tzinfo=now().tzinfo) }}"
device_class: energy
state_class: total
and then in the /share/mosquitto.conf file I have:
And then in regards to the Energy dashboard, I setup a Utility Meter in the Device Helpers pointed to the DTE Energy Bridge sensor. And since I have dynamic peak pricing with DTE, I have 3 ‘tariffs’, Peak, Mid-Peak, and Off-Peak. That generates a few helpers with a select helper you tie up to an automation to change it based on DTE’s times. You can associate the tariffs to pricing and now I get a pretty close approximation to my monthly and daily electricity spend.
I’ve been looking for a solution to the DTE Energy Bridge for years. Thank you for posting the only working solution I’ve ever seen. It works perfectly just as you posted.
Adding my slightly modified version to configuration.yaml seems to work well so far. I’m honestly still trying to figure out the actual USD/kWh rates though.
template:
- sensor:
- name: "D1.2 Inflow"
unit_of_measurement: "USD/kWh"
device_class: monetary
state: >
{% set month = now().month %}
{% set weekday = now().weekday() %}
{% set hour = now().hour %}
{% if month in [10, 11, 12, 1, 2, 3, 4, 5] %}
{% if weekday in [0, 1, 2, 3, 4, 5] and hour >= 15 and hour < 19 %}
0.191
{% else %}
0.177
{% endif %}
{% elif month in [6, 7, 8, 9] %}
{% if weekday in [0, 1, 2, 3, 4, 5] and hour >= 15 and hour < 19 %}
0.234
{% else %}
0.177
{% endif %}
{% endif %}
I love this setup! I implemented most of it yesterday. My only problem is that I can’t get the tariff to audo switch from helper to helper. For instance, I was stuck on Mid Peak all night. Any ideas why it would not me switching?
Still works great for me. I found that 90% of the time, if you ahve issues getting data, it is a MQTT misconfiguration. How do you have MQTT setup? Are you running it as an Add-On in Home Assistant?
I’ve had problems once in a while where the automation doesn’t fire because say I’ve restarted HA during one of the times it should switch over like at 3pm, etc. Wish HA had a better way to handle those cases.
I figured out my goof up. I forgot to change the name of the entity for the helper I made. Seems like all is working well. This is the best setup I’ve found for the energy bridge so far!