P1 Monitor (DSMR) with Solution

Hi,

I’m running hassio on a desktop system that is on the 3rd floor but i have a raspberry with P1 Monitor (P1 Mon connected to my Smart Meter with a P1 cable on the first floor.

And i can’t find a way to use the component DSMR to connect to the P1 Mon system.

Does anybody has this running ? And how did you did it ?

Solution : P1 Monitor does have API links that you could use to retrieve data into HA.

Example sensor.yaml:


 - platform: rest
    resource: http://ip.adress.p1.mon/api/v1/smartmeter?limit=1&json=object&round=on
    name: Huidig verbruik
    value_template: '{{ value_json.0.CONSUMPTION_W }}'
    unit_of_measurement: "W"

  - platform: rest
    resource: http://ip.adress.p1.mon/api/v1/smartmeter?limit=1&json=object&round=off
    name: Meterstand hoog
    value_template: '{{ value_json.0.CONSUMPTION_KWH_HIGH | round(2) }}'
    unit_of_measurement: "kWh"

  - platform: rest
    resource: http://ip.adress.p1.mon/api/v1/smartmeter?limit=1&json=object&round=off
    name: Meterstand laag
    value_template: '{{ value_json.0.CONSUMPTION_KWH_LOW | round(2) }}'
    unit_of_measurement: "kWh"
    
  - platform: rest
    resource: http://ip.adress.p1.mon/api/v1/financial/day?limit=1&json=object&round=off
    name: Kosten Hoog Tarief
    value_template: '{{ value_json.0.CONSUMPTION_COST_ELECTRICITY_HIGH | round(2) }}'
    unit_of_measurement: "€"

  - platform: rest
    resource: http://ip.adress.p1.mon/api/v1/financial/day?limit=1&json=object&round=off
    name: Kosten Laag Tarief
    value_template: '{{ value_json.0.CONSUMPTION_COST_ELECTRICITY_LOW | round(2) }}'
    unit_of_measurement: "€"

  - platform: rest
    resource: http://ip.adress.p1.mon/api/v1/financial/month?limit=1&json=object&round=off
    name: Maand Hoog Tarief
    value_template: '{{ value_json.0.CONSUMPTION_COST_ELECTRICITY_HIGH | round(2) }}'
    unit_of_measurement: "€"

  - platform: rest
    resource: http://ip.adress.p1.mon/api/v1/financial/month?limit=1&json=object&round=off
    name: Maand Laag Tarief
    value_template: '{{ value_json.0.CONSUMPTION_COST_ELECTRICITY_LOW | round(2) }}'
    unit_of_measurement: "€"

  - platform: rest
    resource: http://ip.adress.p1.mon/api/v1/powergas/day?limit=1&json=object&round=off
    name: Verbruik Per Dag
    value_template: '{{ value_json.0.CONSUMPTION_DELTA_KWH | round(4) }}'
    unit_of_measurement: "kWh"

  - platform: template
    sensors:
      energie_kosten_dag:
        value_template: "{{ states('sensor.kosten_hoog_tarief') | float + states('sensor.kosten_laag_tarief') | float | round(2) }}"
        unit_of_measurement: "€"
        
  - platform: template
    sensors:
      energie_kosten_maand:
        value_template: "{{ states('sensor.maand_hoog_tarief') | float + states('sensor.maand_laag_tarief') | float | round(2) }}"
        unit_of_measurement: "€"

The last 2 platform are my costs for energy, one for day cost and one for total monthly cost.

There are more API links that you can use from P1, you can find them in the settings and then API.
If there are more questions please ask.

And i want to thank the guy that helped me to get started to get P1 Mon data into HA.
Thanks Marcel.

I have the same situation RPI connected to the Smart Meter (P1) and Hassio on a NUC somewhere else. I use DSMR Reader [https://github.com/dennissiemensma/dsmr-reader] on the RPI and use MQTT (Mosquito add-on) in Hassio.
This gives me also Gas consumption and price information

Thanks, yes i also found DSMR Reader. But i got P1 Monitor working in Hassio.
Some other user from P1 Monitor helped me with the correct API links.
Now i got all the information in Hassio from my Smart Meter :slight_smile:

Could you please document your solution here. That is a big part of the forum, leaving details of how you fixed something so as to help others in the future.

Yeah sure :slight_smile:

I posted the solution in my first post.

1 Like

Sorry so you did. :slight_smile:

Thanks for sharing as I was looking for a solution for the same situation.

1 Like

I have it up and running now for 12 days and it’s working great.

Added yesterday and it works great, checking if I can add the gas as well in the overview

1 Like

I can’t see how I can use the low and high electricity values per hour. The only low and high values are the total meter figures.

[removed by my because it was a stupid question and it works now]

I tried to get this working but it isn’t!
I use the correct api links, but when i create al these sensors, they don’t show up in home assistant at all.
What am i missing?

Thanks

Fixed: Had to remove “.p1.mon” from the api link!

did somebody the gas info working, use used and costs?

1 Like

I am very new to this home assistant. But how and where do I put this code?
I tried putting it into configurations.yaml, but it failed.

Can you please provide some sort of step by step guide?

Thank you very much!

1 Like

You can add this to the configurations.yaml however you should add the correct ip address.

This should work with your P1 Monitor

I’m new with HA and can’t get it to work. What lines must I write in the configuration yaml to make it work with the sensor.yaml?

Me neither. I have created an sensors.yaml, and included it into the configuration.yaml but they just don’t show up (yes I did do a reboot).

Also I changed it into the right IP address, and when I use the link in the browser I got the right json, but no sensors showing up.

Added some Gas Additions and cost additions:

- platform: rest
  resource: http://192.168.178.72/api/v1/smartmeter?limit=1&json=object&round=off
  name: Meterstand Gas
  value_template: '{{ value_json.0.CONSUMPTION_GAS_M3 | round(2) }}'
  unit_of_measurement: "M3"

- platform: rest
  resource: http://192.168.178.72/api/v1/financial/day?limit=1&json=object&round=off
  name: Kosten Gas
  value_template: '{{ value_json.0.CONSUMPTION_COST_GAS | round(2) }}'
  unit_of_measurement: "€"

- platform: rest
  resource: http://192.168.178.72/api/v1/financial/month?limit=1&json=object&round=off
  name: Maand Gas
  value_template: '{{ value_json.0.CONSUMPTION_COST_GAS | round(2) }}'
  unit_of_measurement: "€"

- platform: rest
  resource: http://192.168.178.72/api/v1/powergas/day?limit=1&json=object&round=off
  name: Verbruik Gas Per Dag
  value_template: '{{ value_json.0.CONSUMPTION_GAS_DELTA_M3 | round(4) }}'
  unit_of_measurement: "M3"

Also now calculation is included with the GAS:

- platform: template
  sensors:
    energie_kosten_dag:
      value_template: "{{ states('sensor.kosten_hoog_tarief') | float + states('sensor.kosten_laag_tarief') | float + states('sensor.kosten_gas') | float | round(2) }}"
      unit_of_measurement: "€"
        
- platform: template
  sensors:
    energie_kosten_maand:
      value_template: "{{ states('sensor.maand_hoog_tarief') | float + states('sensor.maand_laag_tarief') | float + states('sensor.maand_gas') | float | round(2) }}"
      unit_of_measurement: "€"

It looks like it’s working at my side, so help yourself :slight_smile:

Does anyone know the latest update time code for me ?