The automation part of the code works insofar as the variable “input_number.371_previous_propane_level” is populated with the value of “sensor.propane_tank_neevo_371_gallons”
But I don’t understand how the “sensor:” section gets updated daily.
Nor do I understand how this will keep a history of the daily usage.
Stop using LLMs. They are trained on old out of date config and spout bullshit.
Stop using the legacy template platform.
Use the triggered template sensor integration. Use a time trigger for whatever time of day you want it updated. No need for an automation or input number.
Stop asking the LLM. It does not know about any Home Assitant features since it was trained ages ago.
Read the documentation link I provided. Try to configure it yourself based on the example and if you can’t then post what you tried here and we will help.
Most people here are happy to spend their free time helping you understand home assistant for free, but that requires you to make some effort and does not include digging through LLM bullshit (providing confident incorrect answers is bullshit, not hallucination).
Thought I would follow up on my ongoing efforts to get a daily propane gas usage card.
First, though, thank you very much to tom_I
I only have it running for a day, so I’m not sure if it is working, but it looks good so far.
I was able to get this far the help of reading (and re-re-re-reading) the available docs, tom_I, other member’s posts/threads, and ClaudeAI (I know I’m not supposed to because LLM are “untrustworthy” – I feel like I have no choice).
I added the following to the end of configuration.yaml:
# Claude code to update the daily changes at midnight 371
# Store midnight value as before
# Input numbers used to store daily propane level 371
input_number:
midnight_propane_level_371_claude:
name: "Propane Level at Midnight 371 Claude"
min: 0
max: 1000
step: 0.01
propane_refill_amount_371_claude:
name: "Propane Refill Amount Today 371 Claude"
min: 0
max: 1000
step: 0.01
# Claude code to update the daily changes at midnight 630
# Store midnight value as before
# Input numbers used to store daily propane level 371
midnight_propane_level_630_claude:
name: "Propane Level at Midnight 630 Claude"
min: 0
max: 1000
step: 0.01
propane_refill_amount_630_claude:
name: "Propane Refill Amount Today 630 Claude"
min: 0
max: 1000
step: 0.01
Above that (in configuration.yaml), in the template: section, I added:
# This sensor calculates daily propane usage added 12-15-2024
- sensor:
- name: "Daily Propane Usage 371 Claude"
unit_of_measurement: "gal"
state: >
{% set midnight = states('input_number.midnight_propane_level_371_claude') | float %}
{% set current = states('sensor.propane_tank_neevo_371_gallons') | float %}
{% set refill = states('input_number.propane_refill_amount_371_claude') | float %}
{% if is_number(midnight) and is_number(current) and is_number(refill) %}
{{ ((midnight - current) + refill) | round(2) }}
{% else %}
{{ 0 }}
{% endif %}
state_class: measurement
device_class: volume_storage
# This sensor calculates daily propane usage added 12-15-2024
- sensor:
- name: "Daily Propane Usage 630 Claude"
unit_of_measurement: "gal"
state: >
{% set midnight = states('input_number.midnight_propane_level_630_claude') | float %}
{% set current = states('sensor.propane_tank_neevo_630_gallons') | float %}
{% set refill = states('input_number.propane_refill_amount_630_claude') | float %}
{% if is_number(midnight) and is_number(current) and is_number(refill) %}
{{ ((midnight - current) + refill) | round(2) }}
{% else %}
{{ 0 }}
{% endif %}
state_class: measurement
device_class: volume_storage
Then, in automations.yaml, I added:
# Automation to store propane level at 11-30pm daily and reset refill counter 371
- id: "1734348637909"
alias: "Store Midnight Propane Level and Reset Refill Counter 371 Claude"
trigger:
- platform: time
at: "23:30:00"
action:
- service: input_number.set_value
target:
entity_id: input_number.midnight_propane_level_371_claude
data:
value: "{{ states('sensor.propane_tank_neevo_371_gallons') | float }}"
- service: input_number.set_value
target:
entity_id: input_number.propane_refill_amount_371_claude
data:
value: 0
- id: "1734348637919"
alias: "Detect Propane Refill 371 Claude"
trigger:
- platform: state
entity_id: sensor.propane_tank_neevo_371_gallons
condition:
# Only trigger if level increased by more than 10 gallons (adjust this threshold as needed)
- condition: template
value_template: >
{% set current = states('sensor.propane_tank_neevo_371_gallons') | float %}
{% set previous = trigger.from_state.state | float %}
{{ (current - previous) > 0.1 }}
action:
- service: input_number.set_value
target:
entity_id: input_number.propane_refill_amount_371_claude
data:
value: >
{% set current_refill = states('input_number.propane_refill_amount_371_claude') | float %}
{% set new_refill = trigger.to_state.state | float - trigger.from_state.state | float %}
{{ current_refill + new_refill }}
# Automation to store propane level at 11-30pm daily and reset refill counter 630
- id: "1734348637929"
alias: "Store Midnight Propane Level and Reset Refill Counter 630 Claude"
trigger:
- platform: time
at: "23:30:00"
action:
- service: input_number.set_value
target:
entity_id: input_number.midnight_propane_level_630_claude
data:
value: "{{ states('sensor.propane_tank_neevo_630_gallons') | float }}"
- service: input_number.set_value
target:
entity_id: input_number.propane_refill_amount_630_claude
data:
value: 0
- id: "1734348637939"
alias: "Detect Propane Refill 630 Claude"
trigger:
- platform: state
entity_id: sensor.propane_tank_neevo_630_gallons
condition:
# Only trigger if level increased by more than 10 gallons (adjust this threshold as needed)
- condition: template
value_template: >
{% set current = states('sensor.propane_tank_neevo_630_gallons') | float %}
{% set previous = trigger.from_state.state | float %}
{{ (current - previous) > 0.1 }}
action:
- service: input_number.set_value
target:
entity_id: input_number.propane_refill_amount_630_claude
data:
value: >
{% set current_refill = states('input_number.propane_refill_amount_630_claude') | float %}
{% set new_refill = trigger.to_state.state | float - trigger.from_state.state | float %}
{{ current_refill + new_refill }}
I simply am incapable of doing this. Yes, I have tried. Yes, I have read, reread, and rereread. Docs and threads and examples.
Perhaps you all don’t realize how skilled and smart you are and that is the reason for the implied ‘anyone can do it if they just try’ approach here, but it is just not the case.
This is the past 72 hour graph of propone used:
Here is the past 72 graph of propane levels:
Using the propane amounts in the tank for 630 (yellow) as an example:
# Automation to store propane level at 11-30pm daily and reset refill counter 371
- id: "1734348637909"
alias: "Store Midnight Propane Level and Reset Refill Counter 371 Claude"
trigger:
- platform: time
at: "23:30:00"
action:
- service: input_number.set_value
target:
entity_id: input_number.midnight_propane_level_371_claude
data:
value: "{{ states('sensor.propane_tank_neevo_371_gallons') | float }}"
- service: input_number.set_value
target:
entity_id: input_number.propane_refill_amount_371_claude
data:
value: 0
- id: "1734348637919"
alias: "Detect Propane Refill 371 Claude"
trigger:
- platform: state
entity_id: sensor.propane_tank_neevo_371_gallons
condition:
# Only trigger if level increased by more than 10 gallons (adjust this threshold as needed)
- condition: template
value_template: >
{% set current = states('sensor.propane_tank_neevo_371_gallons') | float %}
{% set previous = trigger.from_state.state | float %}
{{ (current - previous) > 10 }}
action:
- service: input_number.set_value
target:
entity_id: input_number.propane_refill_amount_371_claude
data:
value: >
{% set current_refill = states('input_number.propane_refill_amount_371_claude') | float %}
{% set new_refill = trigger.to_state.state | float - trigger.from_state.state | float %}
{{ current_refill + new_refill }}
# Automation to store propane level at 11-30pm daily and reset refill counter 630
- id: "1734348637929"
alias: "Store Midnight Propane Level and Reset Refill Counter 630 Claude"
trigger:
- platform: time
at: "23:30:00"
action:
- service: input_number.set_value
target:
entity_id: input_number.midnight_propane_level_630_claude
data:
value: "{{ states('sensor.propane_tank_neevo_630_gallons') | float }}"
- service: input_number.set_value
target:
entity_id: input_number.propane_refill_amount_630_claude
data:
value: 0
- id: "1734348637939"
alias: "Detect Propane Refill 630 Claude"
trigger:
- platform: state
entity_id: sensor.propane_tank_neevo_630_gallons
condition:
# Only trigger if level increased by more than 10 gallons (adjust this threshold as needed)
- condition: template
value_template: >
{% set current = states('sensor.propane_tank_neevo_630_gallons') | float %}
{% set previous = trigger.from_state.state | float %}
{{ (current - previous) > 10 }}
action:
- service: input_number.set_value
target:
entity_id: input_number.propane_refill_amount_630_claude
data:
value: >
{% set current_refill = states('input_number.propane_refill_amount_630_claude') | float %}
{% set new_refill = trigger.to_state.state | float - trigger.from_state.state | float %}
{{ current_refill + new_refill }}
Here is the configuration.yaml code:
# This sensor calculates daily propane usage added 12-15-2024
- sensor:
- name: "Daily Propane Usage 371 Claude"
unit_of_measurement: "gal"
state: >
{% set midnight = states('input_number.midnight_propane_level_371_claude') | float %}
{% set current = states('sensor.propane_tank_neevo_371_gallons') | float %}
{% set refill = states('input_number.propane_refill_amount_371_claude') | float(0) %}
{% if is_number(midnight) and is_number(current) and is_number(refill) %}
{{ ((midnight - current) + refill) | round(2) }}
{% else %}
{{ 0 }}
{% endif %}
state_class: measurement
device_class: volume_storage
# This sensor calculates daily propane usage added 12-15-2024
- sensor:
- name: "Daily Propane Usage 630 Claude"
unit_of_measurement: "gal"
state: >
{% set midnight = states('input_number.midnight_propane_level_630_claude') | float %}
{% set current = states('sensor.propane_tank_neevo_630_gallons') | float %}
{% set refill = states('input_number.propane_refill_amount_630_claude') | float(0) %}
{% if is_number(midnight) and is_number(current) and is_number(refill) %}
{{ ((midnight - current) + refill) | round(2) }}
{% else %}
{{ 0 }}
{% endif %}
state_class: measurement
device_class: volume_storage
And
# Claude code to update the daily changes at midnight 371
# Store midnight value as before
# Input numbers used to store daily propane level 371
input_number:
midnight_propane_level_371_claude:
name: "Propane Level at Midnight 371 Claude"
min: 0
max: 1000
step: 0.01
propane_refill_amount_371_claude:
name: "Propane Refill Amount Today 371 Claude"
min: 0
max: 1000
step: 0.01
# Claude code to update the daily changes at midnight 630
# Store midnight value as before
# Input numbers used to store daily propane level 371
midnight_propane_level_630_claude:
name: "Propane Level at Midnight 630 Claude"
min: 0
max: 1000
step: 0.01
propane_refill_amount_630_claude:
name: "Propane Refill Amount Today 630 Claude"
min: 0
max: 1000
step: 0.01