"expected a dictionary" error when making template

Hey everyone,

I’ve been fighting with this issue for a while now and I just can’t figure out why this is happening.

I’m trying to convert the temperature reading of a sensor from celsius to fahrenheit and I keep getting this “expected a dictionary” error. I’ve recreated my configuration.yaml, recreated the docker container, and used multiple different text editors including VSCode with the Home Assistant extension and I can’t find any problems with the formatting.

Is there something basic I’m missing here? I’m going to post my whole configuration file since it’s not that big at the moment.

default_config:

tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 10.17.0.30

homeassistant:
- platform: template
  sensors:
    sensorname:
      friendly_name: "sensor friendly name"
      value_template: "{% set t = states('sensor.csstemp1_temperature') | float %}{{((t)*9/5)+32}}"

Thanks so much for any help

The top level heading for a legacy template sensor is sensor: not homeassistant: and your includes should be under homeassistant: (Though I’m pretty sure all the ones you have specified are part of default config at this point).

default_config:

tts:
  - platform: google_translate

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 10.17.0.30

homeassistant:
  automation: !include automations.yaml
  script: !include scripts.yaml
  scene: !include scenes.yaml

sensor:
  - platform: template
    sensors:
      sensorname:
        friendly_name: "sensor friendly name"
        value_template: "{% set t = states('sensor.csstemp1_temperature') | float %}{{((t)*9/5)+32}}"
1 Like