How would one write a function/template for propane gas and energy monitoring?

Your code looks awesome - and I would test it - if the energy settings hadn’t disappeared from my control panel in Home Assistant with the latest updates…

I think you have the magic code that will handle propane energy from things like Tank Utility and others!

Now if I could just find where that config went…

In case anyone is following this thread for directions, the latest 2022 update had a breaking change to the location of the “Energy” feature. Its now underneath Configuration → Dashboards → Energy.

UPDATE
Error in Code Above - There is an error in my code for the automation. Maybe you or someone else can tell me what I am doing wrong.

- id: '1643814344142'
  alias: Percent Propane Yesterday Input Automation
  description: ''
  trigger:
  - platform: time
    at: '23:59:50'
  condition: []
  action:
  - service: input_number.set_value
    target:
      entity_id: input_number.yesterdays_input_number
    data:
      value_template: '{{((states(''sensor.tank_percentage'')) | float) }} '
  mode: single
- id: '1643898478033'
  alias: Set Todays Input Propane Percent Used
  description: ''
  trigger:
  - platform: time
    at: '23:59:00'
  condition: []
  action:
  - service: input_number.set_value
    target:
      entity_id: input_number.daily_propane_percent_used
    data:
      value: '{% set propaneused = (states(''input_number.yesterdays_input_number'')
        | int) - (states(''sensor.tank_percentage'') | int), 0 %}  {{ propaneused|max}}'
  mode: single

ERROR MESSAGES - 2

Error while executing automation automation.percent_propane_today_input_automation: extra keys not allowed @ data[‘value_template’]

Percent Propane Yesterday Input Automation: Error executing script. Invalid data for call_service at pos 1: extra keys not allowed @ data[‘value_template’]

Revised yaml to fix value_template and quotes. Will know more after I use some propane and test.

- id: '1643814344142'
  alias: Percent Propane Yesterday Input Automation
  description: ''
  trigger:
  - platform: time
    at: '23:59:50'
  condition: []
  action:
  - service: input_number.set_value
    target:
      entity_id: input_number.yesterdays_input_number
    data:
      value: "{{((states('sensor.tank_percentage')) | float) }}"
  mode: single
- id: '1643898478033'
  alias: Set Todays Input Propane Percent Used
  description: ''
  trigger:
  - platform: time
    at: '23:59:00'
  condition: []
  action:
  - service: input_number.set_value
    target:
      entity_id: input_number.daily_propane_percent_used
    data:
      value: "{% set propaneused = (states('input_number.yesterdays_input_number')
        | int) - (states('sensor.tank_percentage') | int), 0 %}{{ propaneused|max}}"
  mode: single
1 Like

Any luck? I am still trying to get mine to display.

Yes seems to be working. Not sure about day to day sum. May need to change the settings to not reset everyday because it is a consumption sensor (goes positive one day and when nothing is used goes negative amt)

I got it working with this thread:

1 Like