#template issue

1 messages · Page 1 of 1 (latest)

burnt skiff
#

Been wrestling with AI and an automation involving a template - HASS configurator seems happy with syntax, but a check in dev tools shows an error -

- id: '1777013558614'
  alias: Water Heater On
  description: ''
  triggers:
  - platform: numeric_state
    entity_id: sensor.sun_solar_elevation
    above: 30
  conditions:
    - condition: template
      value_template:
      - {{ states('sensor.monitor_bath_power_power_a') | float(0) < (states('sensor.primo_5_0_1_1_ac_power') | float(0) - 2000) }}
    - condition:
        numeric_state
      entity_id: sensor.sensor_chookin_watertemp_temperature
      below: 50
      action:
      - service: switch.turn_on
      target:
        entity_id: switch.switch_chookin_hotwater
      mode: single
Configuration errors
Error loading /config/configuration.yaml: invalid key: "{"states('sensor.monitor_bath_power_power_a') | float(0) < (states('sensor.primo_5_0_1_1_ac_power') | float(0) - 2000)": None}"
  in "/config/automations.yaml", line 679, column 0
rugged quiverBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

magic brook
#

It's pretty hard to figure out what's wrong without proper formatting

#

You seem to have made your template a list item

burnt skiff
#

Ok, thank you, I haven't been here for ages, forgot the syntax

magic brook
burnt skiff
#

While the yaml is mean't to be easy, I usually just use the UI, haven't had to use templates or yaml prior to this

#

I removed the dash leading the template, still same error though

loud coral
burnt skiff
#

No, so the template should be on the same line as value_template: ?

#

Still get this -

Configuration errors
Error loading /config/configuration.yaml: invalid key: "{"states('sensor.monitor_bath_power_power_a') | float(0) < (states('sensor.primo_5_0_1_1_ac_power') | float(0) - 2000)": None}"
  in "/config/automations.yaml", line 678, column 0
#

Added quotes and it checks out now, although AI says it still has issues

loud coral
#

can you paste the exact line you have in there?

timber pebble
#

and you're likely not using the multi-line notation