If anyone else is being affected by the DTE energy bridge being deprecated, you can use the following configuration instead. I believe this will only work with V1 units.
sensor:
- platform: rest
name: DTE Energy Meter
resource: http://192.168.1.4/instantaneousdemand
device_class: power
state_class: measurement
unit_of_measurement: kW
value_template: '{{value[:10]}}'
availability: '{{float(value[:10]) > 0}}'
Its not hard, but it took me a few minutes to figure out, so I’m hoping it will save someone else time!
I have implemented this configuration on a new instance of HA. I have both instances running for comparison. The old “DTE energy Bridge” integration kWh usage closely matched what was reported from DTE on my bill. However, my new instance using the configuration above is reporting about 28% less kWh. I have tried both left and trapezoidal in the Riemann Sum integration with trapezoidal showing a small increase but not enough to make up the difference from the “DTE Energy Bridge”. I have also noticed that the old DTE Energy Bridge graph of the kw sensor (sensor.dte) doesn’t show any drop-outs or portions of the graph with missing data from an unavailable sensor reading but does show intermittent zero values. However, the new configuration graph is not continuous and many areas in the graph where there is no connection line although for very short periods of time and has no zero values. The values reported just before a blank spot has 16 digits of significant figures whereas all the rest of the values have 3 significant figures. The raw kW values of both the DTE Energy bridge (DTE) and the new configuration (DTE Energy Meter) match.
Is the non contigous regions of the DTE Energy Meter the cause of the reduced kWh report? Is there anyway to massage the kWh reporting in new configuration to make it more closely match the old DTE Energy Bridge integration and the actual values reported to me on my DTE bill?
If I set the Riemann Sum Integral max sub-interval (Trapezoidal or Left) to anything larger than 30 seconds (which is the default for the Rest Sensor Platform), my kWh values are about 20% low (as compared to the original DTE Integration number which closely matched my DTE bill). If I set the sub-interval to 30, my kWh number is about 18% too high. Is there a way to massage the rest platform or Riemann sum to tweak the kWh output to a percentage of my choice? That way, I can zero in on a number that will make my monthly summary closely match my kWh shown on my DTE bill?
For posterity, this is the code I ended up using that mirrors the energy data I get from DTE. I use the left Riemann sum integration with with max sub-interval of 30 seconds. This code results in no gaps or zero values: However, if the DTE power goes out and my HA runs on generator, there will be errors due to zero value replacement. The multiplier of v*1.00 is there just in case I need to tweak the results to better match the DTE website data.
sensor:
- platform: rest
name: DTE Energy Meter Raw
resource: http://192.168.2.39/instantaneousdemand
device_class: power
state_class: measurement
unit_of_measurement: kW
value_template: >
{% set v = value[:10] | float(default=-1) %}
{% if v > 0 %}
{{ (v * 1.00) | round(4) }}
{% else %}
unknown
{% endif %}
template:
- sensor:
- name: DTE Energy Meter
unit_of_measurement: 'kW'
device_class: power
state_class: measurement
state: >
{% if states('sensor.dte_energy_meter_raw') not in ['unavailable', 'unknown'] %}
{{ states('sensor.dte_energy_meter_raw') }}
{% else %}
{{ states('sensor.dte_energy_meter') }}
{% endif %}
I tweaked my yaml and my DTE Energy Bridge V1 now is fully incorporated into my Energy dashboard and matches the data DTE provides very well. I added info to track costs associated withe the DTE “time of day” rates.
sensor:
- platform: rest
name: DTE Raw
unique_id: dte_raw
resource: http://192.168.2.39/instantaneousdemand
device_class: power
state_class: measurement
unit_of_measurement: kW
value_template: >
{% set v = value[:10] | float(default=-1) %}
{% if v > 0 %}
{{ (v * 1.00) | round(4) }}
{% else %}
unknown
{% endif %}
utility_meter:
monthly_energy:
unique_id: monthly_energy
name: Monthly energy
source: sensor.dte_energy_kwh
cycle: monthly
offset:
days: 18
hours: 0
minutes: 0
template:
- sensor:
- name: DTE
# unique_id: dte
unit_of_measurement: 'kW'
device_class: power
state_class: measurement
state: >
{% if states('sensor.dte_raw') not in ['unavailable', 'unknown'] %}
{{ states('sensor.dte_raw') }}
{% else %}
{{ states('sensor.dte') }}
{% endif %}
- sensor:
- name: "DTE D1.11 Rate"
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.20214
{% else %}
0.18725
{% endif %}
{% elif month in [6, 7, 8, 9] %}
{% if weekday in [0, 1, 2, 3, 4, 5] and hour >= 15 and hour < 19 %}
0.24484
{% else %}
0.18725
{% endif %}
{% endif %}
I don’t have the http endpoint but I have mqtt for instantaneousdemand. My instantaneousdemand is not kW but in W. (So I see values like 2200, 6400, and not 2.200, 6.400)
Does the http endpoint return it as kW? (I’m trying to understand if there is something hidden somewhere that is doing the /1000 part to convert W to kW)