Glow / Hildebrand Display - Local MQTT Access - Template Help

Thanks for this, I was going to raise the same issue as I couldn’t understand why the Energy Dashboard stipulates one thing but HA warnings say not allowed. Seemed to me that the HA devs had created a bug without looking at their own documentation.

I read your github issue and the whole process was like “herding cats” or “pulling teeth” as we say in the UK.
Why wasn’t Frenck more supportive by providing examples which you guys asked for? Or was it that he just didn’t understand and just towed the party line until he had to listen?
I had a similar experience re Bluetooth Classic and it’s documentation - ran into Frenck - a brick wall.

Hi - just got this all working but my Import Unit Rate from Octopus is wrong on the device, showing 0.1575 - I wish (!) - more like 0.4… how can I fix this?

@monkeydust you cant. This is the value Octopus have set on your smart meter however they rarely update smart meter values. It is pretty much a waste of time importing this data into HA. Your best bet is to create your own entity and populate the value yourself if you are going to want to use the value for calculations

2 Likes

I spoke to someone at Hildebrand/Glow last week as mine were wrong and had only a fixed value, not changing as I’m on Octopus Flux. They are working on adding settings in the CAD/IHD so you can add them yourself.

1 Like

Yes, Jane said it is in the pipeline but that was a few months back

Just spotted this as i finally got around to working out why my Energy dashboard stats were a bit shot. The actual entities all seemed to be fine, but the stats being used my the dashboard were off (often by a £1.20 or so. I realised that the costs for the previous day was not being fully reset to 0. It would decrease and then about 5 mins past midnight report a value that was just a bit less than yesterdays maximum. So if i got a few days in a row where the number wouldn’t fully zero then the problem just gets progressively worse.

I have now changed the template sensor as above as i was getting the errors when changing the data fields about the last reset not being defined. The numbers seem ok (albeit an exact double of what has actually been used) so i am hopefully for tomorrow. I understand the stats etc have to work with a wide range of sensors bots custom and from devices but i wish it was slightly more user friendly to edit things when they go wrong.

My sensor appear to be working but I get the logs flooded with this:

    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 594, in state
    raise ValueError(
ValueError: Sensor sensor.v2smart_meter_electricity_energy_export has device class 'energy', state class 'total_increasing' unit 'kWh' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'unknown' ()
2023-07-22 16:07:34.050 ERROR (MainThread) [homeassistant.components.mqtt.models] Exception raised when updating state of sensor.v2smart_meter_electricity_energy_export, topic: 'glow/78E36DD0A778/SENSOR/electricitymeter' with payload: b'{"electricitymeter":{"timestamp":"2023-07-22T15:07:25Z","energy":{"export":{"cumulative":0.000,"units":"kWh"},"import":{"cumulative":54647.570,"day":8.906,"week":106.220,"month":419.906,"units":"kWh","mpan":"not available","supplier":"---","price":{"unitrate":0.28080,"standingcharge":0.47910}}},"power":{"value":0.457,"units":"kW"}}}'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 590, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'unknown'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 270, in process_write_state_requests
    entity.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 742, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 810, in _async_write_ha_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 748, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 594, in state
    raise ValueError(
ValueError: Sensor sensor.v2smart_meter_electricity_energy_export has device class 'energy', state class 'total_increasing' unit 'kWh' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'unknown' ()

I suspect your “state class” is incorrect for the sensors.
‘total_increasing’ , will work but causes HA to throw these errors.
If this is the case then the solution is higher up the blog.

This does not appear to work for me:
The system cannot restart because the configuration is not valid: Invalid config for [mqtt]: [attributes] is an invalid option for [mqtt]. Check: mqtt->mqtt->sensor->13->attributes.

This is my config:

mqtt:
  sensor:
    - name: "Smart Meter Electricity: Energy Export"
      unique_id: "smart_meter_electricity_energy_export"
      state_topic: "glow/xxxxxxxx/SENSOR/electricitymeter"
      device_class: "energy"
      unit_of_measurement: "kWh"
      state_class: "total_increasing"
      value_template: "{{ value_json['electricitymeter']['energy']['export']['cumulative'] }}"
      icon: "mdi:flash"

changing the state_class to total and adding:

    attributes:
         last_reset: "{{ today_at('00:00') }}" # required for use as "total" in energy dashboard

generates an error

Have you tried this custom component, it generates all the sensors:

1 Like

Thanks, Ill give it a go :slight_smile:

You are putting this under an mqtt sensor.
It should be a template sensor

I.e

NOT

mqtt:
  sensor:

It should be this

template:
  sensor:

And the attribute is for the Cost sensors only - those under template sensors, not mqtt sensors.
cheers

1 Like

this does work, but i liked the blueprint more because it seperated the gas/elec/monitor as seperate devices!
im still waiting to hear bk from my issue about it

I disagree, the device is the IHD

2 Likes

Thanks for this, has been working great for me for a couple of months. Ended up having to create a Utility Meter helper for “Today’s energy useage” as mine is also resetting at 01:00AM and not 00:00AM.

Question regarding your Monthly Cost calculators, am I right in thinking they are only including 1 days worth of Standing Charge?

I’m getting an issue with the integration (both the manual MQTT setup and the IHD Integration) where the costs in the HA energy dashboard are showing minus costs that seem to be calculated from the previous days usage. For example if I used £3 yesterday HA will show -£3.00 and if I have spent £1.00 today it would show -£2.00. Seems a bit odd.
This only happens in the dashboard, the entity shows correctly.
Any ideas please?

1 Like

What are you using to determine the unit cost ?

Have you checked the sensors you are using do reset to 0 at midnight ?

I’m using the sensors from the integration. But this is what is set on the energy dashboard.

I assume that they are resetting at midnight as when looking at data for the total cost entity I see the below.

I found that total cost entity to be unreliable and not the same as calculated. Try adding unit cost in the energy dashboard instead and let that calculate the costs. I have Octopus Flux so use that integration’s unit cost entity

Anybody else having issues with Electricity showing -ve pricing? It’s been running fine for about a year, just noticed I’m now getting -ve cost for +ve energy usage. I don’t have solar or anything like that.