daniel-jong / esp8266_p1meter

DSMR5 P1 meter to mqtt using esp8266
GNU General Public License v3.0
152 stars 54 forks source link

Any guide? #23

Open impy101 opened 1 year ago

impy101 commented 1 year ago

Is there a guide on how to apply this to home assistant?

I followed your guide and connected my ESP8266 to my meter, setup mqtt on my home assistant and I was hoping there would be a guide somewhere on how to proceed from here (i.e. how to get all the data on my dash)

bartkodden commented 1 year ago

``You have to have the sensors.yaml filled with the correct sensors. There was an update to how home assistant handles sensors so some older examples won't work. My sensors.yaml is this:

# Sensors for esp8266_p1meter to be used in Home Assistant"
sensor:
  - name: "P1 Consumption low Tariff"
    unique_id: "sensor.p1_consumption_low_tariff"
    device_class: "energy"
    state_class: "total_increasing"
    unit_of_measurement: "kWh"
    state_topic: "sensors/power/p1meter/consumption_low_tarif"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 Consumption High Tariff"
    unique_id: "sensor.p1_consumption_high_tariff"
    device_class: "energy"
    state_class: "total_increasing"
    unit_of_measurement: "kWh"
    state_topic: "sensors/power/p1meter/consumption_high_tarif"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 Return Delivery High Tariff"
    unique_id: "sensor.p1_delivery_high_tariff"
    device_class: "energy"
    state_class: "total_increasing"
    unit_of_measurement: "kWh"
    state_topic: "sensors/power/p1meter/returndelivery_high_tarif"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 Return Delivery Low Tariff"
    unique_id: "sensor.p1_delivery_low_tariff"
    device_class: "energy"
    state_class: "total_increasing"
    unit_of_measurement: "kWh"
    state_topic: "sensors/power/p1meter/returndelivery_low_tarif"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 Actual Power Consumption"
    unique_id: "sensor.p1_actual_power_consumption"
    device_class: "energy"
    state_class: "measurement"
    unit_of_measurement: "kW"
    state_topic: "sensors/power/p1meter/actual_consumption"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 Actual Return Delivery"
    unique_id: "sensor.p1_actual_return_delivery"
    device_class: "power"
    state_class: "measurement"
    unit_of_measurement: "kW"
    state_topic: "sensors/power/p1meter/actual_returndelivery"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 L1 Instant Power Usage"
    unique_id: "sensor.p1_l1_instant_power_usage"
    device_class: "power"
    state_class: "measurement"
    unit_of_measurement: "kW"
    state_topic: "sensors/power/p1meter/l1_instant_power_usage"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 L2 Instant Power Usage"
    unique_id: "sensor.p1_l2_instant_power_usage"
    device_class: "power"
    state_class: "measurement"
    unit_of_measurement: "kW"
    state_topic: "sensors/power/p1meter/l2_instant_power_usage"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 L3 Instant Power Usage"
    unique_id: "sensor.p1_l3_instant_power_usage"
    device_class: "power"
    state_class: "measurement"
    unit_of_measurement: "kW"
    state_topic: "sensors/power/p1meter/l3_instant_power_usage"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 L1 Instant Power Current"
    unique_id: "sensor.p1_l1_instant_power_current"
    device_class: "current"
    state_class: "measurement"
    unit_of_measurement: "A"
    state_topic: "sensors/power/p1meter/l1_instant_power_current"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 L2 Instant Power Current"
    unique_id: "sensor.p1_l2_instant_power_current"
    device_class: "current"
    state_class: "measurement"
    unit_of_measurement: "A"
    state_topic: "sensors/power/p1meter/l2_instant_power_current"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 L3 Instant Power Current"
    unique_id: "sensor.p1_l3_instant_power_current"
    device_class: "current"
    state_class: "measurement"
    unit_of_measurement: "A"
    state_topic: "sensors/power/p1meter/l3_instant_power_current"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 L1 Voltage"
    unique_id: "sensor.p1_l1_voltage"
    device_class: "voltage"
    state_class: "measurement"
    unit_of_measurement: "V"
    state_topic: "sensors/power/p1meter/l1_voltage"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 L2 Voltage"
    unique_id: "sensor.p1_l2_voltage"
    device_class: "voltage"
    state_class: "measurement"
    unit_of_measurement: "V"
    state_topic: "sensors/power/p1meter/l2_voltage"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 L3 Voltage"
    unique_id: "sensor.p1_l3_voltage"
    device_class: "voltage"
    state_class: "measurement"
    unit_of_measurement: "V"
    state_topic: "sensors/power/p1meter/l3_voltage"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 Gas Usage"
    unique_id: "sensor.p1_gas_usage"
    device_class: "gas"
    state_class: "total_increasing"
    unit_of_measurement: "m³"
    state_topic: "sensors/power/p1meter/gas_meter_m3"
    value_template: "{{ value|float / 1000 }}"
  - name: "P1 Actual Tariff Group"
    unique_id: "sensor.p1_actual_tariff_group"
    state_topic: "sensors/power/p1meter/actual_tarif_group"
  - name: "P1 Short Power Outages"
    unique_id: "sensor.p1_short_power_outages"
    state_topic: "sensors/power/p1meter/short_power_outages"
  - name: "P1 Long Power Outages"
    unique_id: "sensor.p1_long_power_outages"
    state_topic: "sensors/power/p1meter/long_power_outages"
  - name: "P1 Short Power Drops"
    unique_id: "sensor.p1_short_power_drops"
    state_topic: "sensors/power/p1meter/short_power_drops"
  - name: "P1 Short Power Peaks"
    unique_id: "sensor.p1_short_power_peaks"
    state_topic: "sensors/power/p1meter/short_power_peaks"
jdschuitemaker commented 1 year ago

This is not working for me also. I have the sensors.yaml filled with the example from @bartkodden and added the following line to my configuration.yaml:

sensor: !include sensors.yaml

When I check the configuration in Developer Tools I see this error:

Invalid config for [sensor]: required key not provided @ data['platform']. Got None. (See /config/configuration.yaml, line 19).

Help is very much appreciated!

thijsdeschildre commented 1 year ago

same issue here, including the sensors with the sample file spawns that error

thijsdeschildre commented 1 year ago

This is not working for me also. I have the sensors.yaml filled with the example from @bartkodden and added the following line to my configuration.yaml:

sensor: !include sensors.yaml

When I check the configuration in Developer Tools I see this error:

Invalid config for [sensor]: required key not provided @ data['platform']. Got None. (See /config/configuration.yaml, line 19).

Help is very much appreciated!

I think I got it working. add this to configuration.yaml:

homeassistant:
  packages: !include_dir_named packages

create the directory "packages" in the config dir, and place the file there