sensor:
  - platform: "mqtt"
    state_topic: "smartmeter/current_l1"
    unit_of_measurement: "A"
    value_template: "{{ value.split(' ') | first | float }}"
    device_class: "current"
    name: "Smartmeter: Current Delivered"
  - platform: "mqtt"
    state_topic: "smartmeter/electricity_failures"
    value_template: "{{ value.split(' ') | first | int }}"
    name: "Smartmeter: Number of Electricity Failures"
  - platform: "mqtt"
    state_topic: "smartmeter/electricity_long_failures"
    value_template: "{{ value.split(' ') | first | int }}"
    name: "Smartmeter: Number of Long Electricity Failures"
  - platform: "mqtt"
    state_topic: "smartmeter/electricity_tariff"
    value_template: "{{ value.split(' ') | first | int }}"
    name: "Smartmeter: Energy Tariff"
  - platform: "mqtt"
    state_topic: "smartmeter/energy_delivered_tariff1"
    unit_of_measurement: "kWh"
    value_template: "{{ value.split(' ') | first | float }}"
    device_class: "energy"
    name: "Smartmeter: Energy Delivered tariff 1"
  - platform: "mqtt"
    state_topic: "smartmeter/energy_delivered_tariff2"
    unit_of_measurement: "kWh"
    value_template: "{{ value.split(' ') | first | float }}"
    device_class: "energy"
    name: "Smartmeter: Energy Delivered tariff 2"
  - platform: "mqtt"
    state_topic: "smartmeter/gas_delivered"
    unit_of_measurement: "m3"
    value_template: "{{ value.split(' ') | first | float }}"
    name: "Smartmeter: Gas Delivered"
  - platform: "mqtt"
    state_topic: "smartmeter/timestamp"
    device_class: "timestamp"
    value_template: '{{ strptime(value | regex_replace("[^0-9]*", ""), "%y%m%d%H%M%S") }}'
    name: "Smartmeter: Last Measurement"
  - platform: "mqtt"
    state_topic: "smartmeter/power_delivered"
    unit_of_measurement: "kW"
    value_template: "{{ value.split(' ') | first | float }}"
    device_class: "power"
    name: "Smartmeter: Power Delivered"
