cyberjunky / home-assistant-toon_smartmeter

This component reads and displays sensor values from the meteradapter connected to a rooted Toon thermostat.
MIT License
27 stars 13 forks source link

Gas used last hour #70

Closed butanon2 closed 10 months ago

butanon2 commented 1 year ago

Hi,

I want to use "Gas used today"

Is this possible to adjust this option in the code?

DennisDeKoster commented 1 year ago

I would like this too, Toon has a tile with gas today. Gas last hour isn't very helpful. Is it possible to add this?

DennisDeKoster commented 1 year ago

Never mind, I found a way to store the gas used value at midnight and calculate todays usage.

DennisDeKoster commented 1 year ago

If someone would like to use this, here's my solution:

  1. Create a numeric helper, in my case input_number.gasmeter_stand_gisteren

  2. Make an automation to store the current gas usage at midnight.

alias: Gasmeter stand opslaan
description: ""
trigger:
  - platform: time
    at: "23:59:59"
condition: []
action:
  - service: input_number.set_value
    data:
      value: "{{ states('sensor.toon_gas_used_cnt') }}"
    target:
      entity_id: input_number.gasmeter_stand_gisteren
    alias: Onthoud gasmeterstand
mode: single
  1. Then add this template sensor to the configuration.yaml and use this new entity sensor.gas_verbruik_vandaag in your dashboard.
sensor:
  - platform: template
    sensors:
      gas_verbruik_vandaag:
        friendly_name: "Gasverbruik vandaag"
        unit_of_measurement: 'm3'
        icon_template: mdi:meter-gas
        value_template: "{{ (states('sensor.toon_gas_used_cnt') | float - states('input_number.gasmeter_stand_gisteren') | float) | round(2)}}"
1mfaasj commented 11 months ago

If someone would like to use this, here's my solution:

  1. Create a numeric helper, in my case input_number.gasmeter_stand_gisteren
  2. Make an automation to store the current gas usage at midnight.
alias: Gasmeter stand opslaan
description: ""
trigger:
  - platform: time
    at: "23:59:59"
condition: []
action:
  - service: input_number.set_value
    data:
      value: "{{ states('sensor.toon_gas_used_cnt') }}"
    target:
      entity_id: input_number.gasmeter_stand_gisteren
    alias: Onthoud gasmeterstand
mode: single
  1. Then add this template sensor to the configuration.yaml and use this new entity sensor.gas_verbruik_vandaag in your dashboard.
sensor:
  - platform: template
    sensors:
      gas_verbruik_vandaag:
        friendly_name: "Gasverbruik vandaag"
        unit_of_measurement: 'm3'
        icon_template: mdi:meter-gas
        value_template: "{{ (states('sensor.toon_gas_used_cnt') | float - states('input_number.gasmeter_stand_gisteren') | float) | round(2)}}"

Why not using an utility meter and set it on every dag And the source: toon_gas_used_cnt? Easier and faster solution I think

cyberjunky commented 11 months ago

Why not using an utility meter and set it on every dag And the source: toon_gas_used_cnt? Easier and faster solution I think

Thanks, added it to the README, not tested yet (awaiting midnight)