You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Energy Usage to the API -> Home Assistant Energy Usage #7
I'm thinking maybe Hourly could be reported downstream to Home Assistant to make NuHeat contribute to the Energy stats for consumption devices in a similar manner to how some smart plugs report energy consumption.
I've done the this work to update the Neurio component, hopefully that will arrive with in HA's 2021.12.1 release. I'd be cool to try to make this work downstream for HA's NuHeat component (though I'm not a native python dev; so might take a while to get merged). :)
I up-vote this request for the API to support hourly energy reporting. I too use Home Assistant with a nuheat thermostat and would appreciate the energy data being available.
Thanks.
A little further investigation seems to indicate that they aren't actually metering anything - simply estimate kWh based on your indicated 1) Square Footage 2) Hours of Runtime, and 3) Watts per square foot (which they say is generally 12W).
So you can replicate this pretty easily with a Template Sensor like this:
Just replace 12 with your expected W/Area and 28 with the Area of your heated floor. That will create a Power sensor and you can then create an Integration Helper to get kWh used.
I'm going to try and validate this against the API but it seems to be having some issues currently.
Just replace 12 with your expected W/Area and 28 with the Area of your heated floor. That will create a Power sensor and you can then create an Integration Helper to get kWh used.
I have used a very similar approach for years. The cable in my floor has a rated draw of 6 amps. That times 120 volts gives me 720 watts. That times runtime (using an integration sensor) yields kWh. My template power sensor is quite similar to yours, but I added a tiny amount of random variation to the values. Otherwise, the integration sensor doesn't work correctly.
@trdischat - What exactly breaks the integral? I haven't put in that randomness - I guess I could, but would like to understand what exactly I'm working around.
The Integral sensor is designed to calculate the Riemann sum of a source sensor's values over time. However, there can be issues when the source sensor's value remains unchanged for extended periods. If your source sensor consistently reports the same value (e.g., a constant power draw), the Integral sensor may not update until the source sensor's value changes. This can lead to inaccurate integration results, as the integral isn't calculated over the duration the value was constant. For example, if you're integrating power (Watts) to get energy (Watt-hours) and the power sensor reports a steady value, the energy calculation will not be updated until the power value changes, even though energy is being consumed during that period. See home-assistant/core#88940.
One way to address this issue is to add a tiny amount of random jitter to the sensor values, which triggers updates to the Integral sensor without significantly affecting the overall integral calculation. The other recommendation is to use the left method for the Riemann sum, since it is best for "rectangular functions which are very stable for long periods of time and change very rapidly." A final suggestion, which I haven't tried yet, is to set the max_sub_interval option to something other than zero in your Integral sensor. This triggers an update to the sensor periodically, even if the source value doesn't change. It is possible that this option would make it unnecessary to inject random jitter into the power sensor.
The Integral sensor is designed to calculate the Riemann sum of a source sensor's values over time. However, there can be issues when the source sensor's value remains unchanged for extended periods. If your source sensor consistently reports the same value (e.g., a constant power draw), the Integral sensor may not update until the source sensor's value changes. This can lead to inaccurate integration results, as the integral isn't calculated over the duration the value was constant. For example, if you're integrating power (Watts) to get energy (Watt-hours) and the power sensor reports a steady value, the energy calculation will not be updated until the power value changes, even though energy is being consumed during that period. See home-assistant/core#88940.
One way to address this issue is to add a tiny amount of random jitter to the sensor values, which triggers updates to the Integral sensor without significantly affecting the overall integral calculation. The other recommendation is to use the left method for the Riemann sum, since it is best for "rectangular functions which are very stable for long periods of time and change very rapidly." A final suggestion, which I haven't tried yet, is to set the max_sub_interval option to something other than zero in your Integral sensor. This triggers an update to the sensor periodically, even if the source value doesn't change. It is possible that this option would make it unnecessary to inject random jitter into the power sensor.
Thanks! I am using left already due to that recommendation and have that periodic update piece set as well. Will try to report back if I see issues - so far it it seems to be working.
I put a clamp-on meter on the breaker for my floor heat to measure the
heater's amps and multiplied that by the measured voltage to get watts (a
100% power factor is a good bet with this resistive load).
My template is just like yours, but instead of 12 * 28 = 336, I have 8.92A
* 120V = 1,070W. I now use the floor heater in the master bath much less
than previously.... Is more knowledge a good thing? Hard to say.
As for the Rhiman sum to compute energy, I use the Left method and it seems
to work with a constant load value, but I may put in a bit of a random
flutter as noted by others.
On Sun, Jul 6, 2025 at 2:23 PM Josh Barnard ***@***.***> wrote:
*barndawgie* left a comment (broox/python-nuheat#7)
<#7 (comment)>
A little further investigation seems to indicate that they aren't actually
metering anything - simply estimate kWh based on your indicated 1) Square
Footage 2) Hours of Runtime, and 3) Watts per square foot (which they say
is generally 12W).
So you can replicate this pretty easily with a Template Sensor like this:
{% if state_attr('climate.basement_bath','hvac_action') == 'heating'%}
{{ 12 * 28 | int }}{% else %}
{{ 0 }}{% endif %}
Just replace 12 with your expected W/Area and 28 with the Area of your
heated floor. That will create a Power sensor and you can then create an
Integration Helper to get kWh used.
—
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AL2THYXQCL3XPITNPRHCBH33HGHWFAVCNFSM6AAAAABS7CXWGWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTANBSGY2TENBZGE>
.
You are receiving this because you commented.Message ID:
***@***.***>
Activity
kaijk commentedon Jan 16, 2022
I up-vote this request for the API to support hourly energy reporting. I too use Home Assistant with a nuheat thermostat and would appreciate the energy data being available.
Thanks.
trdischat commentedon Jul 2, 2022
Just adding my voice to this request. It certainly looks like the nuheat API supports queries for energy use.
kut commentedon Dec 4, 2024
Looks like the GET endpoint
/api/v1/EnergyLog/Day/{serialNumber}/{date}would return:See: https://api.mynuheat.com/swagger/
Do folks still think this is interesting? I also would be very interested in adding this to Home Assistant energy monitoring...
barndawgie commentedon Jul 6, 2025
A little further investigation seems to indicate that they aren't actually metering anything - simply estimate kWh based on your indicated 1) Square Footage 2) Hours of Runtime, and 3) Watts per square foot (which they say is generally 12W).
So you can replicate this pretty easily with a Template Sensor like this:
Just replace 12 with your expected W/Area and 28 with the Area of your heated floor. That will create a Power sensor and you can then create an Integration Helper to get kWh used.
I'm going to try and validate this against the API but it seems to be having some issues currently.
trdischat commentedon Jul 6, 2025
I have used a very similar approach for years. The cable in my floor has a rated draw of 6 amps. That times 120 volts gives me 720 watts. That times runtime (using an integration sensor) yields kWh. My template power sensor is quite similar to yours, but I added a tiny amount of random variation to the values. Otherwise, the integration sensor doesn't work correctly.
barndawgie commentedon Jul 7, 2025
@trdischat - What exactly breaks the integral? I haven't put in that randomness - I guess I could, but would like to understand what exactly I'm working around.
trdischat commentedon Jul 7, 2025
The Integral sensor is designed to calculate the Riemann sum of a source sensor's values over time. However, there can be issues when the source sensor's value remains unchanged for extended periods. If your source sensor consistently reports the same value (e.g., a constant power draw), the Integral sensor may not update until the source sensor's value changes. This can lead to inaccurate integration results, as the integral isn't calculated over the duration the value was constant. For example, if you're integrating power (Watts) to get energy (Watt-hours) and the power sensor reports a steady value, the energy calculation will not be updated until the power value changes, even though energy is being consumed during that period. See home-assistant/core#88940.
One way to address this issue is to add a tiny amount of random jitter to the sensor values, which triggers updates to the Integral sensor without significantly affecting the overall integral calculation. The other recommendation is to use the
leftmethod for the Riemann sum, since it is best for "rectangular functions which are very stable for long periods of time and change very rapidly." A final suggestion, which I haven't tried yet, is to set themax_sub_intervaloption to something other than zero in your Integral sensor. This triggers an update to the sensor periodically, even if the source value doesn't change. It is possible that this option would make it unnecessary to inject random jitter into the power sensor.barndawgie commentedon Jul 7, 2025
Thanks! I am using
leftalready due to that recommendation and have that periodic update piece set as well. Will try to report back if I see issues - so far it it seems to be working.kaijk commentedon Jul 7, 2025
eric commentedon Jan 11, 2026
I'm working on exposing this in the nuheat component directly: home-assistant/core#160751
eric commentedon Jan 13, 2026
Here's the pull request here related to this: #21