Glow / Hildebrand Display - Local MQTT Access - Template Help

Ignore that, just saw your post further up saying it’s fixed

1 Like

I changed the import today template to that but it didn’t work so I am not sure what else I can change .Just to confirm: I didn’t create a new one, just changed the value template to the one from @duffyd and also removed any change to the cost today value template I had. Am I missing anything? Thanks!

It sounds like you have copied and pasted without applying to your use case.

You need to change minute from my orinal code which is 1 to a minute after your importa resets to last night, for the energy type with the problem. Gas if i remember rightly. So if it reverts to the previous night with a spike at 5 minutes past midnight replace that with something greater. Like 10 mins past

1 Like

Hello!

Thanks ! I actually changed the value_template from your original code to:

    - name: "Smart Meter Gas: Import (Today)"
      unique_id: "smart_meter_gas_import_today"
      state_topic: "glow/REDACTED/SENSOR/gasmeter"
      device_class: "energy"
      unit_of_measurement: "kWh"
      state_class: "measurement"
      value_template: >
        {% if value_json['gasmeter']['energy']['import']['day'] == 0 %}
          {% if now() > now().replace(hour=0).replace(minute=20).replace(second=0).replace(microsecond=0) %}
            {{ states('sensor.smart_meter_gas_debug_calc_import_today') }}
          {% else %}
            {{ value_json['gasmeter']['energy']['import']['day'] }}
          {% endif %}
        {% else %}
          {% if now() < now().replace(hour=0).replace(minute=20).replace(second=0).replace(microsecond=0) %}
            {{ 0 }}
          {% else %}
            {{ value_json['gasmeter']['energy']['import']['day'] }}
          {% endif %}
        {% endif %}
      icon: "mdi:fire"

Isn’t that what I was suposed to do?

Edit: Realised something wrong on the 3rd line (states), I haven’t changed that and just amended it, will update tomorrow.

Hi, is it normal the gas cost doesn’t go to zero at midnight? It only resets to zero when the boiler next fires - around 6am…

Hey @robertalexa

Looks like the fact that I didn’t change the actual entity name was the culprit, second time in a row it all works as intended.
Thanks for the help on this one!

It usually resets at midnight. It might not be the reason but can you double check if the meter’s time and your HA’s server are correct?

They both reported the correct time, this was something I checked during initial investigation of this “issue” when other users asked me about it. We suspected it to be a summer time/time zone problem, but turned out it was just the smart meter being “stupid”

Yes they are correct as my electricity resets at midnight just fine. It’s just the gas that has issues :frowning:

I am just in the process of setting this up with mqtt discovery so can group the sensors as a device instead of all separately. I’ve just done it as an automation, added a few sensors for now. If anyone interested let me know and will share config as I go

Edit… So yeah that seems to have worked :grinning:

1 Like

Would be good to know how you’ve done this? Just ordered my CAD (upgrading from a Hildebrand Glowstick as the CAD now has Local MQTT!) so doing some research on how to get this all setup when it arrives.

No worries, I’ll stick it on git and share. I got it set us as an automation to set up the device, should be fairly straightforward.

Is there anything my HACS integration is missing? I havent been keeping up with the excellent latest and greatest MQTT templates!

Did you manage to put this on Git? Or have you not had a chance yet?

@north3221 any chance you was able to pop your config/automation onto git? I have the IHD on its way and my current GlowStick doesn’t appear to be updating HA anymore so I’m not sure where to start when the IHD arrives in the next couple of days

Hey everyone. Just looking for a bit of help. I have added all the code from second post (split into separate files) however I can’t get gas import or gas import today entites to appear in HA after several reboots. I got the Hildebrand IHD a couple of days ago. All other entities have been created and are gathering data. The gas import is using this. Ode:

mqtt:
  sensor:  
    - name: "Smart Meter Gas: Import"
      unique_id: "smart_meter_gas_import"
      state_topic: !secret smart_ihd_state_topic_gas
      device_class: "energy"
      unit_of_measurement: "kWh"
      state_class: "total_increasing"
      value_template: >
        {% if value_json['gasmeter']['energy']['import']['cumulative'] == 0 %}
          {{ states('sensor.smart_meter_gas_import') }}
        {% else %}
          {{ value_json['gasmeter']['energy']['import']['cumulative'] }}
        {% endif %}
      icon: "mdi:fire"

State topic is correct as it is the same line gas import this week and gas import this month. I’m running HA 2023.1.1. Also, no errors showing in the logs.
I have installed Megakids GitHub code and that works however ideally I would like to maintain the code myself.

I have even tried adding the debug gas import today entity with:

    - name: "Smart Meter Debug Gas: Import (Today)"
      unique_id: 1ffc7daa-b602-47a8-8621-ac4cd02ec57a
      state_topic: !secret smart_ihd_state_topic_gas
      device_class: "energy"
      unit_of_measurement: "kWh"
      state_class: "measurement"
      value_template: "{{ value_json['gasmeter']['energy']['import']['day'] }}"
      icon: "mdi:fire"

Again, no joy after reboots

Go to your mqtt integration and listen on that topic and see what data you get from the ihd. I am assuming the ihd is correctly connected to the gas meter and shows data on its display?

@robertalexa yes, the display shows data, so does MegaKid integration.
Listening on the above topic I get the following:

{
   "gasmeter":{
      "timestamp":"2023-01-08T19:08:44Z",
      "energy":{
         "import":{
            "cumulative":29383.496,
            "day":31.261,
            "week":170.543,
            "month":182.924,
            "units":"kWh",
            "cumulativevol":2722.072,
            "cumulativevolunits":"m3",
            "dayvol":2.896,
            "weekvol":15.799,
            "monthvol":16.946,
            "dayweekmonthvolunits":"m3",
            "mprn":"MPRN",
            "supplier":"---",
            "price":{
               "unitrate":0.10296,
               "standingcharge":0.28485
            }
         }
      }
   }
}

That is indeed weird. I am assuming you already double checked, indentation is correct on the file, no duplicate unique ids, no typos etc. Does the entity not show up at all in HA or just the energy dashboard configuration dropdowns?

@robertalexa I have checked file indentation, duplicate ID, duplicate UDID etc. it’s very strange. For the unique_id I have tried the original example from your post, I have tried using File Editor and creating new ID from the menu etc but still no joy. The entities themselves aren’t in the Settings - Devices & Services - Entities, even when I enable disabled and hidden filters (the week and month import ones are though which is the very strange thing).
The only thing I have left to try is delete the files, restart and create again manually by hand rather than copy/paste/tweak. I guess I could try finding the entity file register and checking that?
My meters are SMETS1 but my assumption is because data is coming into MQTT as above the meters themselves are irrelevant as the registries are present