I use a reed magnetic pulse counter to read my gas usage from my meter. (Courtesy Toonwater.nl).
Toonwater.nl provided a script to import values in HA, which works just fine. All sensors work, and I can display them individually on a separate dashboard.
However, we are struggling to get the values into the energy dashboard in m3.
This is the script in question:
# gasmeter toongas
# UTILITYS gasMETER
utility_meter:
gasverbruik_dit_kwartier:
source: sensor.gasmeter_quantity
cycle: quarter-hourly
gasverbruik_dit_uur:
source: sensor.gasmeter_quantity
cycle: hourly
gasverbruik_vandaag:
source: sensor.gasmeter_quantity
cycle: daily
gasverbruik_deze_week:
source: sensor.gasmeter_quantity
cycle: weekly
gasverbruik_deze_maand:
source: sensor.gasmeter_quantity
cycle: monthly
gasverbruik_dit_kwartaal:
source: sensor.gasmeter_quantity
cycle: quarterly
gasverbruik_dit_jaar:
source: sensor.gasmeter_quantity
cycle: yearly
# gasmeter toongas
sensor:
# CALCULATIE gasMETER
- platform: template
sensors:
gasprijs_per_dag:
friendly_name: "Kosten gasverbruik Vandaag"
unit_of_measurement: "EUR"
icon_template: "mdi:currency-eur"
value_template: >-
{% set a = states('sensor.gasverbruik_vandaag') | float %}
{% set b = states('input_number.gasprijs_per_m3') | float /1000 %}
{% set c = states('input_number.belasting_op_gas') | float /1000 %}
{% set d = states('input_number.vastrecht_gas') | float / 365 %}
{{ (((a * b) + a * c) + d) | round(2) }}
gasprijs_per_week:
friendly_name: "Kosten gasverbruik Deze Week"
unit_of_measurement: "EUR"
icon_template: "mdi:currency-eur"
value_template: >-
{% set a = states('sensor.gasverbruik_vandaag') | float %}
{% set b = states('input_number.gasprijs_per_m3') | float /1000 %}
{% set c = states('input_number.belasting_op_gas') | float /1000 %}
{% set d = states('input_number.vastrecht_gas') | float / 52 %}
{{ (((a * b) + a * c) + d) | round(2) }}
gasprijs_per_maand:
friendly_name: "Kosten gasverbruik Deze Maand"
unit_of_measurement: "EUR"
icon_template: "mdi:currency-eur"
value_template: >-
{% set a = states('sensor.gasverbruik_vandaag') | float %}
{% set b = states('input_number.gasprijs_per_m3') | float /1000 %}
{% set c = states('input_number.belasting_op_gas') | float /1000 %}
{% set d = states('input_number.vastrecht_gas') | float /12 %}
{{ (((a * b) + a * c) + d) | round(2) }}
gasprijs_per_kwartaal:
friendly_name: "Kosten gasverbruik Dit Kwartaal"
unit_of_measurement: "EUR"
icon_template: "mdi:currency-eur"
value_template: >-
{% set a = states('sensor.gasverbruik_vandaag') | float %}
{% set b = states('input_number.gasprijs_per_m3') | float /1000 %}
{% set c = states('input_number.belasting_op_gas') | float /1000 %}
{% set d = states('input_number.vastrecht_gas') | float / 4 %}
{{ (((a * b) + a * c) + d) | round(2) }}
gasprijs_per_jaar:
friendly_name: "Kosten gasverbruik Dit Jaar"
unit_of_measurement: "EUR"
icon_template: "mdi:currency-eur"
value_template: >-
{% set a = states('sensor.gasverbruik_vandaag') | float %}
{% set b = states('input_number.gasprijs_per_m3') | float /1000 %}
{% set c = states('input_number.belasting_op_gas') | float /1000 %}
{% set d = states('input_number.vastrecht_gas') | float %}
{{ (((a * b) + a * c) + d) | round(2) }}
- platform: rest
name: gasmeter
json_attributes:
- gasflow
- gasquantity
- RSSI
- version
resource: http://192.168.0.147/gas.html
- platform: template
sensors:
gasmeter_flow:
friendly_name: "Huidige gasflow"
unique_id: "gasmeter_Flow"
value_template: '{{states.sensor.gasmeter.attributes["gasflow"] }}'
unit_of_measurement: "l/m"
icon_template: "mdi:gas-pump"
gasmeter_quantity:
friendly_name: "Huidige gasmeterstand"
unique_id: "gasmeter_Stand"
value_template: '{{states.sensor.gasmeter.attributes["gasquantity"] }}'
unit_of_measurement: "L"
icon_template: "mdi:gas"
gasmeter_wifi:
friendly_name: "gasmeter Wifi"
unique_id: "gasmeter_Wifi"
unit_of_measurement: "dB"
value_template: '{{states.sensor.gasmeter.attributes["RSSI"] }}'
icon_template: "mdi:wifi-arrow-up-down"
gasmeter_versie:
friendly_name: "gasmeter Versie"
unique_id: "gasmeter_Versie"
value_template: '{{states.sensor.gasmeter.attributes["version"] }}'
#SENSOREN GASVERBRUIK PER PERIODE
gasverbruik_gisteren:
friendly_name: gasverbruik Gisteren
unit_of_measurement: "L"
icon_template: "mdi:gas"
value_template: "{{ state_attr('sensor.gasverbruik_vandaag','last_period') }}"
gasverbruik_vorige_week:
friendly_name: gasverbruik Vorige Week
unit_of_measurement: "L"
icon_template: "mdi:gas"
value_template: "{{ state_attr('sensor.gasverbruik_deze_week','last_period') }}"
gasverbruik_vorige_maand:
friendly_name: gasverbruik Vorige Maand
unit_of_measurement: "L"
icon_template: "mdi:gas"
value_template: "{{ state_attr('sensor.gasverbruik_deze_maand','last_period') }}"
gasverbruik_vorig_jaar:
friendly_name: gasverbruik Vorig Jaar
unit_of_measurement: "L"
icon_template: "mdi:gas"
value_template: "{{ state_attr('sensor.gasverbruik_dit_jaar','last_period') }}"
I’ve tried every option I found on the community pages, on reddit, etc… to no avail.
Anyone any insights?