Hi all!
This post might just serve as a sanity check for - but i hope someone can help verify if my approach getting energy information to show up on the new energy tab - is correct.
I have bought a smart-me han module. my Electrical Meter is From Kamstrup, and they provice a HAN port - that smart-me created an device for.
This module has the possibility to transfer my electrical meter readings to their cloud service.
They have a free REST based API - that i currently use - but you can actually also connect to the device via MODBUS over TCP - which i have not yet looked into.
I have integrated my device - with sensors - based on this rest call:
https://smart-me.com:443/api/Devices/<<device_uid>>
which gives me this in return:
{
"Id": "DeviceID",
"Name": "ElektravejHAN",
"Serial": mySerial,
"DeviceEnergyType": 1,
"FamilyType": 6,
"ActivePower": 0.425,
"ActivePowerUnit": "kW",
"CounterReading": 22684.57,
"CounterReadingUnit": "kWh",
"CounterReadingT1": 22684.57,
"CounterReadingT2": 0.0,
"CounterReadingT3": 0.0,
"CounterReadingT4": 0.0,
"CounterReadingImport": 22684.57,
"CounterReadingExport": 0.0,
"Voltage": 233.0,
"VoltageL1": 233.0,
"VoltageL2": 234.0,
"VoltageL3": 233.0,
"CurrentL1": 1.41,
"CurrentL2": 1.16,
"CurrentL3": 0.98,
"ActiveTariff": 1,
"ValueDate": "2021-09-17T11:42:47.6264689Z"
}
I have then created the following sensors in my configuration.yaml file:
rest:
- authentication: basic
username: "[email protected]"
password: "password"
scan_interval: 30
resource: https://smart-me.com:443/api/Devices/<<device_uid>>
sensor:
- name: "EL aktuelt forbrug" #this shows the current use i kw
value_template: '{{ value_json.ActivePower }}'
unit_of_measurement: "kW"
device_class: "power"
json_attributes:
- "ActivePower"
- "Name"
- "Serial"
- "ActivePower"
- name: "EL MĂĽler" #this shows the meter reading - from when the meter was installed
value_template: '{{ value_json.CounterReading}}'
unit_of_measurement: "kWh"
device_class: "energy"
json_attributes:
- "ActivePower"
- "Name"
- "Serial"
- "ActivePower"
and then - to make it visible in the energy tab - i have created a template sensor - based on the meter
template:
- sensor:
- name: "El aktuelt forbrug stat"
unit_of_measurement: kW
state: "{{ states('sensor.el_aktuelt_forbrug') }}"
attributes:
device_class: power
state_class: measurement
#last_reset: "{{ state_attr('sensor.eloverblik_energy_total', 'metering_date') }}"
- sensor:
- name: "El MĂĽler stat" #the one that i use on the energy tab
unit_of_measurement: kWh
state: "{{ states('sensor.el_maler') }}"
attributes:
device_class: energy
state_class: total_increasing
I have then added the âEl mĂĽler statâ to th energy section - as well as my fixed price. pr. kwh
the values - are the current meter value - itâs an ever increasing value - that will never be reset - so it will keep increasing over time.
now - this is shown in the energy tab:
Now this seems âsaneâ - and as you can see data is flowing in.
But should i do more - to enable this to exist over time? right now i am not sure if i will loose my data when i restart my HA server?
I have also been looking into creating an utility meter - to show me the âpriceâ, but i havenât quite figured out how to do this yet.
Have anyone else used the smart-me han integration?
Best regards
Ronni