06 ‐ Getting the data into Home Assistant - ronbuist/remeha-can-interface GitHub Wiki

Getting the data into Home Assistant

This page is not going to provide an introduction to Home Assistant. I'm going to assume you know about Home Assistant and have your own instance up and running. I'm also going to assume this runs on a different machine as the Remeha CAN scripts. I'm also assuming you have set up the webserver as I described on this page.

Additions to configuration.yaml

Add the following lines to your Home Assistant configuration.yaml file:

  - platform: rest
    resource: http://aaa.bbb.ccc.ddd/remeha.json
    name: Remeha CAN
    unique_id: "remeha_can"
    value_template: 'OK'
    scan_interval: 10
    json_attributes:
      - datetime
      - statusid
      - statusdescription
      - flowtemperature
      - setpoint
      - power
      - pressure

Replace aaa.bbb.ccc.ddd with the IP address of your Raspberry Pi that's running the Remeha CAN scripts.

Set up the individual sensors

We have now set up one sensor which has several attributes. However, it's more useful to have individual sensors for all the JSON attributes. We can do this using template sensors. Add the following to configuration.yaml:

  - platform: template
    sensors:
      remeha_datetime:
        value_template: '{{ states.sensor.remeha_can.attributes["datetime"] }}'
      remeha_statusid:
        value_template: '{{ states.sensor.remeha_can.attributes["statusid"] }}'
      remeha_flowtemperature:
        value_template: '{{ states.sensor.remeha_can.attributes["flowtemperature"] }}'
        unit_of_measurement: "°C"
      remeha_setpoint:
        value_template: '{{ states.sensor.remeha_can.attributes["setpoint"] }}'
        unit_of_measurement: "°C"
      remeha_power:
        value_template: '{{ states.sensor.remeha_can.attributes["power"] }}'
        unit_of_measurement: "%"
      remeha_pressure:
        value_template: '{{ states.sensor.remeha_can.attributes["pressure"] }}'
        unit_of_measurement: "bar"
      remeha_statusdescription:
        value_template: '{{ states.sensor.remeha_can.attributes["statusdescription"] }}'

You can now add the individual sensors to your dashboards in any way you would like to. As an example, this is a history graph combining the status description with the flow temperature:

Automation for sending low pressure warning

Now that we have a sensor for the boiler pressure, we can use it to send a message when the pressure is too low. I have chosen to check daily, which will lead to the message being sent once a day until the boiler is repressurised. Add the following to your Home Assistant automations:

alias: Boiler Pressure Warning
description: Send daily warning message if boiler pressure is getting too low.
triggers:
  - trigger: time
    at: "19:00:00"
conditions:
  - condition: numeric_state
    entity_id: sensor.remeha_pressure
    below: 0.8
actions:
  - action: notify.mobile_app_iphone_van_ron
    metadata: {}
    data:
      title: Boiler pressure too low
      message: >-
        The pressure in the Remeha boiler is currently {{
        states('sensor.remeha_pressure') }} bar. This is too low. Please
        repressurise!
mode: single

Splitting gas consumption between hot water and central heating