Anyone able to develop a Home Assistant Custom Component or templating ?

I’ve just got the Glow CAD to go with my new smart meters for Agile Octopus.

I’m planning in the next few months to get Solar and a Powerwall.

I’ve linked the MQTT data to Home Assistant using the Node Red flow that was published in this forum (thanks!)

It’s the first time I’ve used Node Red, and I’d prefer to not need a Node Red Server if I could achieve the same in a custom component. I might even have a go at creating one or trying to achieve the JSON splitting and maths using templating.

Before I do, thought I’d ask if anyone has already got the data through to Home Assistant without using Node Red?


Thanks.

Comments

  • There is a Home Assistant component available here but it is lacking key features. As for templating, I might give it a go as I've played with it before and it's really not that tough. The JSON that the MQTT stream produces is a bit obscure so I might need some tinkering.

    If you'd like to have a go at it yourself, I would suggest running my mosquitto_sub command to see what MQTT spits out and looking at Home Assistant's templating guide to extract the values you need from it. I haven't figured out myself what all these values mean.

  • edited July 21

    I actually heard back from Jane from Hildebrand support, she suggested I look into the Zigbee Smart Energy Profile specification to understand the format of the MQTT payload.

    It isn't a very pleasant read, but the biggest takeaway there is that the elecMtr.0702.04.00 JSON path in the JSON payload will give you (after converting from hex to decimal) electricity consumption (it is not available for gas as that is only picked up every half hour), and the elecMtr.0702.00.00 as well as gasMtr.0702.00.00 JSON paths should give you electricity and gas meter readings.

    A bit of background on the different fields from reading the docs:

    0702: Metering
    - 00: Reading Information Set
     - 00: CurrentSummationDelivered: energy consumed (meter)
     - 01: CurrentSummationReceived: solar panels production?
     - 02: CurrentMaxDemandDelivered: ?
     - 07: ReadingSnapshotTime: UTC time
     - 14: Supply Status: 0x2 is on
    - 02: Meter Status
    - 03: Formatting
    - 04: Historical Consumption
     - 00: InstantaneousDemand (Signed)
     - 01: CurrentDayConsumptionDelivered
     - 30: CurrentWeekConsumptionDelivered
     - 40: CurrentMonthConsumptionDelivered
    0705: Prepayment
    0708: Device Management
    
  • Well done on plowing through the Zigbee SEP spec, welcome to our world! ;)

    Thanks for adding to the knowledge base and welcome to the forums @ndfred

  • that's great, thanks. I'm having a go now.

  • I figured it out! I published a writeup of how to configure Home Assistant to work with a Glow device over MQTT:

    https://gist.github.com/ndfred/5bb51b567f8cfaf2bb06da6393169321

  • edited July 23

    Ok, success.

    I'm using hassOS with the Mosquitto Broker.

    So first thing was to bridge the Bright MQTT to my mosquitto MQTT:

    In Mosquitto Broker config:

    customize:  

    active: true 

    folder: mosquitto

    Then in /share/mosquitto/glowmqtt.conf

    connection glowmqtt

     address glowmqtt.energyhive.com:8883

     topic SMART/HILD/XXXXXXXXXX in 0

     try_private false

     notifications true

     start_type automatic

     remote_clientid glow

     remote_username xxxxxxxxxxxxxxx

     remote_password xxxxxxxxxxx

     keepalive_interval 300

     cleansession true

     bridge_protocol_version mqttv311

     local_clientid homeassistant

     bridge_cafile /etc/ssl/certs/ca-certificates.crt


    Then in the YAML:


    sensor:

     - platform: mqtt

      name: "MQTT Elec Meter"

      device_class: power

      icon: mdi:counter

      unit_of_measurement: "kwh"

      state_topic: "SMART/HILD/XXXXXXXXXXX"

      value_template: "{{ ((value_json.elecMtr['0702']['00']['00'] | int(base=16)) / 1000 )| int }}"

     - platform: mqtt

      name: "MQTT Elec Demand"

      device_class: power

      icon: mdi:flash-alert

      unit_of_measurement: "kw"

      state_topic: "SMART/HILD/XXXXXXXXXXX"

      value_template: "{{ (value_json.elecMtr['0702']['04']['00'] | int(base=16)) / 1000 }}"

     - platform: mqtt

      name: "MQTT Export Power"

      device_class: power

      icon: mdi:flash-outline

      unit_of_measurement: "kwh"

      state_topic: "SMART/HILD/XXXXXXXXXXX"

      value_template: "{{ (value_json.elecMtr['0702']['00']['01'] | int(base=16)) / 1000 }}"

     - platform: mqtt

      name: "MQTT Grid Power"

      device_class: power

      unit_of_measurement: "kwh"

      icon: mdi:flash-circle

      state_topic: "SMART/HILD/XXXXXXXXXXX"

      value_template: "{{ ((value_json.elecMtr['0702']['04']['00'] | int(base=16))-(value_json.elecMtr['0702']['00']['01'] | int(base=16))) / 1000  }}"

     - platform: mqtt

      name: "MQTT Gas Meter"

      device_class: power

      icon: mdi:speedometer-slow

      unit_of_measurement: "kwh"

      state_topic: "SMART/HILD/XXXXXXXXXXX"

      value_template: "{{( (value_json.gasMtr['0702']['00']['00'] | int(base=16)) / 1000) | int }}"

     - platform: mqtt

      name: "MQTT pan"

      state_topic: "SMART/HILD/XXXXXXXXXXX"

      value_template: "{{ value_json['pan']['status'] }}"

      json_attributes_topic: "SMART/HILD/XXXXXXXXXXX"

      json_attributes_template: "{{ value_json.pan | tojson }}"   

  • just need to work out how to deal with the signed hex in :

     - 00: InstantaneousDemand (Signed)
    


  • Or I could have read your post above properly that said you’d written the instructions, that are pretty similar to mine !

  • edited July 23

    If you are not exporting energy just treat InstantaneousDemand as unsigned.

Sign In or Register to comment.