Home Assistant Instellen 2

Volg deze handleiding om Home Assistant in te stellen (uitgebreid)

Volg eerst de wifi instellen om de module in te stellen op een statisch ip adres. Maak ook backups voordat je gaat wijzigen.

Het aanmaken van de helpers om de literprijs, vastrecht en belasting op te kunnen geven. Ga via Instellingen naar het menu Helpers. Maak 3 helpers aan:

  1. Waterprijs per Liter met als Entiteits-ID input_number.waterprijs_per_liter
  2. Belasting op Leidingwater met als Entiteits_ID  input_number.belasting_op_leidingwater
  3. Vastrecht water met als Entiteits_ID input_number.vastrecht_water

Dan met de file Editor de map watermeter aanmaken.

En daar het bestand watermeter.yaml in plaatsen. Download het bestand hieronder en hernoem het bestand naar .yaml. In dit bestand op regel 96 het juist IP adres invoeren.

En dan als laatste deze regel toevoegen in configuration.yaml

packages: !include_dir_named watermeter

Dan configuratie controleren, opnieuw opstarten en men kan de Entiteiten toevoegen.

sensors:
  - platform: rest 
    name: watermeter 
    json_attributes: 
      - waterflow 
      - waterquantity 
    resource: http://192.168.10.137/water.html

template:
  - sensor: 
      name: "Watermeter Flow" 
      state: '{{states.sensor.watermeter.attributes["waterflow"] }}' 
      state_class: "measurement" 
      unit_of_measurement: "l/m" 
      icon: "mdi:water-pump" 
 - sensor: 
      name: "Watermeter Quantity" 
      state: '{{states.sensor.watermeter.attributes["waterquantity"] }}' 
      state_class: "measurement" 
      unit_of_measurement: "l" 
      icon: "mdi:water"

utility_meter:
  hourly_water:
    source: sensor.watermeter_quantity
    cycle: hourly
    name: Hourly Water
  daily_water:
    source: sensor.watermeter_quantity
    cycle: daily
    name: Daily Water
  monthly_water:
    source: sensor.watermeter_quantity
    cycle: monthly
    name: Monthly Water

# Watermeter toonWater
# UTILITYS WATERMETER    
utility_meter:
  waterverbruik_dit_kwartier:  
    source: sensor.watermeter_quantity
    cycle: quarter-hourly
  waterverbuik_dit_uur:
    source: sensor.watermeter_quantity
    cycle: hourly
  waterverbuik_vandaag:
    source: sensor.watermeter_quantity
    cycle: daily    
  waterverbuik_deze_week:
    source: sensor.watermeter_quantity
    cycle: weekly
  waterverbuik_deze_maand:
    source: sensor.watermeter_quantity
    cycle: monthly
  waterverbuik_dit_kwartaal:
    source: sensor.watermeter_quantity
    cycle: quarterly
  waterverbuik_dit_jaar:
    source: sensor.watermeter_quantity
    cycle: yearly
 

# Watermeter toonWater 
sensor:
  - platform: mqtt
    name: "toonwater"
    state_topic: "tele/esp-toonWater/SENSOR"
    unit_of_measurement: "L"
    force_update: true

      
# CALCULATIE WATERMETER
  - platform: template
    sensors: 
      waterprijs_per_dag:
        friendly_name: "Kosten Waterverbruik Vandaag"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {% set a = states('sensor.waterverbuik_vandaag') | float %}
          {% set b = states('input_number.waterprijs_per_liter') | float %}
          {% set c = states('input_number.belasting_op_leidingwater') | float  %}
          {% set d = states('input_number.vastrecht_water') | float / 365 %}
          {{ (((a * b) + a * c) + d) | round(2) }}  
      waterprijs_per_week:
        friendly_name: "Kosten Waterverbruik Deze Week"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {% set a = states('sensor.waterverbuik_deze_week') | float %}
          {% set b = states('input_number.waterprijs_per_liter') | float %}
          {% set c = states('input_number.belasting_op_leidingwater') | float  %}
          {% set d = states('input_number.vastrecht_water') | float / 52 %}
          {{ (((a * b) + a * c) + d) | round(2) }}    
      waterprijs_per_maand:
        friendly_name: "Kosten Waterverbruik Deze Maand"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {% set a = states('sensor.waterverbuik_deze_maand') | float %}
          {% set b = states('input_number.waterprijs_per_liter') | float %}
          {% set c = states('input_number.belasting_op_leidingwater') | float  %}
          {% set d = states('input_number.vastrecht_water') | float /12 %}
          {{ (((a * b) + a * c) + d) | round(2) }}
      waterprijs_per_kwartaal:
        friendly_name: "Kosten Waterverbruik Dit Kwartaal"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {% set a = states('sensor.waterverbuik_dit_kwartaal') | float %}
          {% set b = states('input_number.waterprijs_per_liter') | float %}
          {% set c = states('input_number.belasting_op_leidingwater') | float  %}
          {% set d = states('input_number.vastrecht_water') | float / 4 %}
          {{ (((a * b) + a * c) + d) | round(2) }}
      waterprijs_per_jaar:
        friendly_name: "Kosten Waterverbruik Dit Jaar"
        unit_of_measurement: "EUR"
        icon_template: "mdi:currency-eur"
        value_template: >-
          {% set a = states('sensor.waterverbuik_dit_jaar') | float %}
          {% set b = states('input_number.waterprijs_per_liter') | float %}
          {% set c = states('input_number.belasting_op_leidingwater') | float  %}
          {% set d = states('input_number.vastrecht_water') | float  %}
          {{ (((a * b) + a * c) + d) | round(2) }}    


  - platform: rest
    name: watermeter
    json_attributes:
      - waterflow
      - waterquantity
    resource: http://192.168.178.34/water.html
  - platform: template
    sensors:
      watermeter_flow:
        friendly_name: "Huidige waterflow"
        value_template: '{{states.sensor.watermeter.attributes["waterflow"] }}'
        unit_of_measurement: "l/m"
        icon_template: "mdi:water-pump"
      watermeter_quantity:
        friendly_name: "Huidige watermeterstand"
        value_template: '{{states.sensor.watermeter.attributes["waterquantity"] }}'
        unit_of_measurement: "L"
        icon_template: "mdi:water"

#SENSOREN WATERVERBRUIK PER PERIODE
      waterverbruik_gisteren:
        friendly_name: Waterverbruik Gisteren
        unit_of_measurement: L
        icon_template: "mdi:water"
        value_template: "{{ state_attr('sensor.waterverbuik_vandaag','last_period') }}"
      waterverbruik_vorige_week:
        friendly_name: Waterverbruik Vorige Week
        unit_of_measurement: L
        icon_template: "mdi:water"
        value_template: "{{ state_attr('sensor.waterverbuik_deze_week','last_period') }}"
      waterverbruik_vorige_maand:
        friendly_name: Waterverbruik Vorige Maand
        unit_of_measurement: L
        icon_template: "mdi:water"
        value_template: "{{ state_attr('sensor.waterverbuik_deze_maand','last_period') }}"
      waterverbruik_vorig_jaars:
        friendly_name: Waterverbruik Vorig Jaar
        unit_of_measurement: L
        icon_template: "mdi:water"
        value_template: "{{ state_attr('sensor.waterverbuik_dit_jaar','last_period') }}"
sensors:
  - platform: rest 
    name: watermeter 
    json_attributes: 
      - waterflow 
      - waterquantity 
    resource: http://192.168.10.137/water.html

template:
  - sensor: 
      name: "Watermeter Flow" 
      state: '{{states.sensor.watermeter.attributes["waterflow"] }}' 
      state_class: "measurement" 
      unit_of_measurement: "l/m" 
      icon: "mdi:water-pump" 
 - sensor: 
      name: "Watermeter Quantity" 
      state: '{{states.sensor.watermeter.attributes["waterquantity"] }}' 
      state_class: "measurement" 
      unit_of_measurement: "l" 
      icon: "mdi:water"

utility_meter:
  hourly_water:
    source: sensor.watermeter_quantity
    cycle: hourly
    name: Hourly Water
  daily_water:
    source: sensor.watermeter_quantity
    cycle: daily
    name: Daily Water
  monthly_water:
    source: sensor.watermeter_quantity
    cycle: monthly
    name: Monthly Water