Glow / Hildebrand Display - Local MQTT Access - Template Help

Thanks! Those numbers are fine to me as well but the sources look broken, very weird.

That is very weird - those numbers under “Sources” in the “Energy” dashboard are still OK for me:

I assume those are configured to be calculated using the “Import Unit Rate” entities - do you see them go negative at any time? Or maybe the “Import Standing Charge” given that it’s negative even at zero usage?

1 Like

That’s what’s weird, I have all of them positive and not giving me any negative or 0 value, the calculation per day is showing the correct amount (and the sources amount of power also, 0.3kw is correct there too) and that’s why I am at a loss to what could be happening seeing the last thing I changed was the device_class and state_class but yours is correct so I haven’t got an idea why (yet).

I checked my configuration.yaml again and it turns out I had missed some of the entities, in particular these two which could explain why I didn’t see any change:

Logger: homeassistant.components.sensor
Source: components/sensor/__init__.py:503
Integration: Sensor (documentation, issues)
First occurred: 1:34:13 AM (3 occurrences)
Last logged: 1:34:50 AM

    Entity sensor.smart_meter_electricity_cost_today (<class 'homeassistant.components.template.sensor.SensorTemplate'>) is using state class 'total_increasing' which is impossible considering device class ('monetary') it is using; expected None or one of 'total'; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+template%22
    Entity sensor.smart_meter_electricity_import_today (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using state class 'measurement' which is impossible considering device class ('energy') it is using; expected None or one of 'total', 'total_increasing'; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mqtt%22

I’ve updated them similarly now and will check over the next few days and let you know if I see the same negative cost values on the Energy dashboard.

I’m seeing the zero cost value myself now - seems the Energy dashboard doesn’t like the updated state class:

Changing that entity’s “state_class” back to “measurement” removes that warning and will presumably fix it, but I do now see another warning:

For reference, these validations for the entities used by the Energy dashboard seem to come from here:

And the log warnings I noticed are relatively new, only introduced a month or so ago:

Perhaps it was a false positive and these warnings need some refining.

In short, I think best to stick with the original configuration from @robertalexa at the start of this thread for now - trying to fix these log warnings probably causes more hassle than it’s worth. :upside_down_face:

@alexhk90 what state_class did you change it to? I had to change from measurement to ‘total_increasing’ as this sensor is NOT to be recording the given point in time energy usage; we want to track consumption. The following is my code, works perfectly for energy dashboard

mqtt:
  sensor:  
    - name: "Smart Meter Electricity: Import (Today)"
      unique_id: 6e1691a4-0c3d-43a3-9e3f-4726d0009994
      state_topic: !secret smart_ihd_state_topic_electric
      device_class: "energy"
      unit_of_measurement: "kWh"
      state_class: "total_increasing"
#      state_class: "measurement"
      value_template: >
        {% if value_json['electricitymeter']['energy']['import']['day'] == 0 
          and now() > now().replace(hour=0).replace(minute=1).replace(second=0).replace(microsecond=0) %}
          {{ states('sensor.smart_meter_electricity_import_today') }}
        {% else %}
          {{ value_json['electricitymeter']['energy']['import']['day'] }}
        {% endif %}
      icon: "mdi:flash"
    - name: "Smart Meter Gas: Import (Today)"
      unique_id: "smart_meter_gas_import_today"
      state_topic: !secret smart_ihd_state_topic_gas
      device_class: "energy"
      unit_of_measurement: "kWh"
      state_class: "total_increasing"
#      state_class: "measurement"
      value_template: >
        {% if value_json['gasmeter']['energy']['import']['day'] == 0
          and now() > now().replace(hour=0).replace(minute=1).replace(second=0).replace(microsecond=0) %}
          {{ states('sensor.smart_meter_gas_import_today') }}
        {% else %}
          {{ value_json['gasmeter']['energy']['import']['day'] }}
        {% endif %}
      icon: "mdi:fire"

See here https://community.home-assistant.io/t/energy-dashboard-last-reset-missing/406733/2 which states:
The state class for “energy” entities should be “total_increasing” (energy consumed since the last reset), “measurement” is suitable for “power” entities expressed in W…

I also changed those “Today” “energy” ones from “measurement” to “total_increasing” - that seems to work OK as far as I can tell. The issue with the Energy dashboard came from changing the “Cost (Today)” “monetary” one from “measurement” to no “state_class” (remove that line altogether).

Ah ok. My bad. I thought you meant the consumption sensor. I have other sensors and automations setup from before I got this IHD (had the USB stick before) that I use for costs due to being on Go tariff and needing price to change up and down at 12:30am and 4:30am

Hey!

Thanks for the update!
Yes, it’s weird, I tried some different combinations and had no luck so I got the monetary’s state_class restored and kept the energy ones.
I will let you know what happens on this side.

Edit: I returned the whole thing to what it was before to see if the dashboard works, I will ignore the warnings for now.

This is driving me nuts so now even with the same configuration as RobertAlexa’s post, I am still getting negative values in Sources Cost (Energy works fine and is correct), think I have changed everything I could includng trying to reset statistics.

Edit: Managed to get it sorted but I won’t touch the device/state classes, will leave it like that.

1 Like

Does the local MQTT integration work with the USB stick or just the IHD, please?

@jamesking Just the IHD as it has local mqtt server built in. USB stick is via Hildebrand MQTT (which I believe is called bridged MQTT to your local instance)

1 Like

Thanks for the response.

So if I already have an MQTT server I can’t just connect the USB to my MQTT server and then use this integration?

Ideally I would prefer to get the stick as it’s cheaper, and use a it Google Home Hub as a display.

@jamesking with USB stick you can use your own local mqtt, but need to setup the bridged mqtt (Hildebrand cloud mqtt to your local). Before I got the Hildebrand IHD I was using the following:
https://github.com/unlobito/ha-hildebrandglow but it took a fair bit to setup being as I have smets1 meters.

If you haven’t got any device yet, the IHD is only £20 more

2 Likes

Just to add to what @Townsmcp said, it’s well worth it as you won’t depend on Hildebrand’s MQTT server, the IHD connects directly to your WiFi and to your smart meter so no internet involved at all.

2 Likes

I’m beginning to come to this conclusion - that the in home display is the best way to keep it fully local. Also a good backup when my home assistant efforts inevitably fail.

I wonder if Octopus Energy would give me one of these specific IHDs when my smart meters are provided.

@jamesking they will give you the normal IHD (my meters are due to be replaced next month and I intend to remove their IHD and leave the Hildebrand one running) but they won’t have mqtt for you to pull stats.
I have been reading the Hildebrand DCC integration and it seems like Hild have infrastructure issues with capacity at the moment and lots of people saying consumption figures are not matching what has actually been used. By having their IHD you won’t encounter these issues as your not relying on DCC data

1 Like

I have an IHD that was provided by EDF and I moved to Octopus to their Tracker tariff beginning of February. The issue with the IHDs is that Octopus is not able to update their tariffs (Agile or Tracker) that have half an hour or daily prices so the IHD will always display the incorrect prices due to the meters being using the wrong tariff which is not helfpul. What I did was getting rid of the EDF (which is also the same Octopus uses) and use Hildebrand’s one only for live consumption (electrcity) and the amount of kWh I am using so not using cost at all as it would be wrong.

1 Like

Yes. This seems to be the best plan and then get the Octopus integration (which I already have working on my tracker tariff) and multiply my power (Hildebrand) by price )octopus) to get live cost.

Then make a dashboard for it and display it on a Google home hub display.

Thanks everyone for the clarification.

1 Like