Problem yaml syntax

A newbee question. How can ik solve this problem in home assistant.

I made 3 number booleans:

input_number.gas_jaarplanning
input_number.gas_nu
input_number.var_gas_beginstand

gas_jaarplanning=value:2000
gas_beginstand=value:1000
gas_nu=value:1500 (sensor:sensor.gas_consumed)

In templates.yaml I put the following:

- trigger:
  - platform: time_pattern
    minutes: "/1"
    
 name: “Gas”   
    unit_of_measurement: m3
    state: >
          {{state('input_number.gas_nu')=state(‘input_number.gas_jaarplanning’)-state(input_number.var_gas_beginstand)}}

Valid configuration gives:
Error loading /config/configuration.yaml: while parsing a block mapping in “/config/templates.yaml”, line 1, column 3 expected , but found ‘’ in “/config/templates.yaml”, line 14, column 4

line14= name: “Gas”

Peter

Spaces matter for YAML (2 spaces at a time) The last line looks like incorrect spacing?

Check the inverted commas, some are wrong:


“Gas”

‘input_number.gas_jaarplanning’

or missing:


input_number.var_gas_beginstand

Plus - as mentioned above- the indentation of line 14 is wrong.

1 Like

Thanks for the response. I have been programming in PHP for a long time and home assistant is still very new to me. It was indeed an indent error. The configuration is now OK.
What should I do now to start the calculation so that the value is written in the correct boolean.