Hi,
I just switched to a new “smart” electricity meter (SagemCom T211) and wanted a way to read the telegram data from the P1 port.
I have read the DSMR Slimme Meter Integration and the DSMR Reader Integration and tried to build the sensor myself. After a couple of days fiddling with ESPs, resistance and breadboards, I gave up and ordered a DSMR-logger v4.5 from circuit.nl (Slimme meter uitlezer V4.5).
It’s probably cheaper to solder it yourself, but I couldn’t wait any longer for all the parts to come in.
You can find an example for HA integration on their documentation, but I wanted more sensors and used their RESTful api to get all the data I needed.
Maybe someone else needs this so I will share this here. I have commented out all the fields I don’t need, but in case I change mind, it’s handy to have them there.
rest:
- resource: http://192.168.1.21/api/v1/sm/fields
scan_interval: 10
sensor:
# {"fields":[
#0 {"name": "identification", "value": "FLU5=253769484_A"},
#1 {"name": "p1_version", "value": "50216"},
#2 {"name": "p1_version_be", "value": "-"},
#3 {"name": "timestamp", "value": "221025144346S"},
#4 {"name": "equipment_id", "value": "3153414733313030353238363836"},
#5 {"name": "energy_delivered_tariff1", "value": 66.762, "unit": "kWh"},
- unique_id: energy_delivered_tariff1
name: "P1 Energy Delivered Tariff 1"
value_template: "{{ value_json.fields[5].value }}"
unit_of_measurement: "kWh"
state_class: "total_increasing"
device_class: "energy"
#6 {"name": "energy_delivered_tariff2", "value": 69.430, "unit": "kWh"},
- unique_id: energy_delivered_tariff2
name: "P1 Energy Delivered Tariff 2"
value_template: "{{ value_json.fields[6].value }}"
unit_of_measurement: "kWh"
state_class: "total_increasing"
device_class: "energy"
#7 {"name": "energy_returned_tariff1", "value": 66.505, "unit": "kWh"},
- unique_id: energy_returned_tariff1
name: "P1 Energy Returned Tariff 1"
value_template: "{{ value_json.fields[7].value }}"
unit_of_measurement: "kWh"
state_class: "total_increasing"
device_class: "energy"
#8 {"name": "energy_returned_tariff2", "value": 13.086, "unit": "kWh"},
- unique_id: energy_returned_tariff2
name: "P1 Energy Returned Tariff 2"
value_template: "{{ value_json.fields[8].value }}"
unit_of_measurement: "kWh"
state_class: "total_increasing"
device_class: "energy"
#9 {"name": "electricity_tariff", "value": "0001"},
- unique_id: electricity_tariff
name: "P1 Energy Tariff Period"
value_template: "{{ value_json.fields[9].value }}"
#10 {"name": "power_delivered", "value": 0.000, "unit": "kW"},
- unique_id: p1_power_delivered
name: "P1 Power Delivered"
value_template: "{{ value_json.fields[10].value }}"
unit_of_measurement: "kW"
state_class: "measurement"
device_class: "power"
#11 {"name": "power_returned", "value": 0.237, "unit": "kW"},
- unique_id: p1_power_returned
name: "P1 Power Returned"
value_template: "{{ value_json.fields[11].value }}"
unit_of_measurement: "kW"
state_class: "measurement"
device_class: "power"
#12 {"name": "electricity_threshold", "value": 999.900, "unit": "kW"},
#13 {"name": "electricity_switch_position", "value": 1},
#14 {"name": "electricity_failures", "value": "-"},
#15 {"name": "electricity_long_failures", "value": "-"},
#16 {"name": "electricity_failure_log", "value": "-"},
#17 {"name": "electricity_sags_l1", "value": "-"},
#18 {"name": "electricity_sags_l2", "value": "-"},
#19 {"name": "electricity_sags_l3", "value": "-"},
#20 {"name": "electricity_swells_l1", "value": "-"},
#21 {"name": "electricity_swells_l2", "value": "-"},
#22 {"name": "electricity_swells_l3", "value": "-"},
#23 {"name": "message_short", "value": "-"},
#24 {"name": "message_long", "value": ""},
#25 {"name": "voltage_l1", "value": 237.800, "unit": "V"},
#26 {"name": "voltage_l2", "value": 0.000, "unit": "V"},
#27 {"name": "voltage_l3", "value": 238.600, "unit": "V"},
#28 {"name": "current_l1", "value": 1.400, "unit": "A"},
#29 {"name": "current_l2", "value": 1.930, "unit": "A"},
#30 {"name": "current_l3", "value": 0.590, "unit": "A"},
#31 {"name": "power_delivered_l1", "value": 0.000, "unit": "kW"},
- unique_id: power_delivered_l1
name: "P1 Power Delivered L1"
value_template: "{{ value_json.fields[31].value }}"
unit_of_measurement: "kW"
state_class: "measurement"
device_class: "power"
#32 {"name": "power_delivered_l2", "value": 0.000, "unit": "kW"},
- unique_id: power_delivered_l2
name: "P1 Power Delivered L2"
value_template: "{{ value_json.fields[32].value }}"
unit_of_measurement: "kW"
state_class: "measurement"
device_class: "power"
#33 {"name": "power_delivered_l3", "value": 0.009, "unit": "kW"},
- unique_id: power_delivered_l3
name: "P1 Power Delivered L3"
value_template: "{{ value_json.fields[33].value }}"
unit_of_measurement: "kW"
state_class: "measurement"
device_class: "power"
#34 {"name": "power_returned_l1", "value": 0.246, "unit": "kW"},
- unique_id: power_returned_l1
name: "P1 Power Returned L1"
value_template: "{{ value_json.fields[34].value }}"
unit_of_measurement: "kW"
state_class: "measurement"
device_class: "power"
#35 {"name": "power_returned_l2", "value": 0.000, "unit": "kW"},
- unique_id: power_returned_l2
name: "P1 Power Returned L2"
value_template: "{{ value_json.fields[35].value }}"
unit_of_measurement: "kW"
state_class: "measurement"
device_class: "power"
#36 {"name": "power_returned_l3", "value": 0.000, "unit": "kW"},
- unique_id: power_returned_l3
name: "P1 Power Returned L3"
value_template: "{{ value_json.fields[36].value }}"
unit_of_measurement: "kW"
state_class: "measurement"
device_class: "power"
#37 {"name": "mbus1_device_type", "value": "-"},
#38 {"name": "mbus1_equipment_id_tc", "value": "-"},
#39 {"name": "mbus1_equipment_id_ntc", "value": "-"},
#40 {"name": "mbus1_valve_position", "value": "-"},
#41 {"name": "mbus1_delivered", "value": 0.000, "unit": "m3"},
#42 {"name": "mbus1_delivered_ntc", "value": "-"},
#43 {"name": "mbus1_delivered_dbl", "value": "-"},
#44 {"name": "mbus2_device_type", "value": "-"},
#45 {"name": "mbus2_equipment_id_tc", "value": "-"},
#46 {"name": "mbus2_equipment_id_ntc", "value": "-"},
#47 {"name": "mbus2_valve_position", "value": "-"},
#48 {"name": "mbus2_delivered", "value": 0.000, "unit": "GJ"},
#49 {"name": "mbus2_delivered_ntc", "value": "-"},
#50 {"name": "mbus2_delivered_dbl", "value": "-"},
#51 {"name": "mbus3_device_type", "value": "-"},
#52 {"name": "mbus3_equipment_id_tc", "value": "-"},
#53 {"name": "mbus3_equipment_id_ntc", "value": "-"},
#54 {"name": "mbus3_valve_position", "value": "-"},
#55 {"name": "mbus3_delivered", "value": 0.000, "unit": "m3"},
#56 {"name": "mbus3_delivered_ntc", "value": "-"},
#57 {"name": "mbus3_delivered_dbl", "value": "-"},
#58 {"name": "mbus4_device_type", "value": "-"},
#59 {"name": "mbus4_equipment_id_tc", "value": "-"},
#60 {"name": "mbus4_equipment_id_ntc", "value": "-"},
#61 {"name": "mbus4_valve_position", "value": "-"},
#62 {"name": "mbus4_delivered", "value": 0.000, "unit": "m3"},
#63 {"name": "mbus4_delivered_ntc", "value": "-"},
#64 {"name": "mbus4_delivered_dbl", "value": "-"}
# ]}
I also added a “gauge” sensor for my dashboard to check if I’m injecting power or getting power from the grid:
-platform: template
sensors:
p1_power_gauge:
friendly_name: "P1 Power Gauge"
value_template: "{{ 0 -(states.sensor.p1_power_returned.state | float) +(states.sensor.p1_power_delivered.state | float) }}"
unit_of_measurement: 'kWh'
device_class: "energy"