Value_template not working since updating HA

I have a connection to moonraker. If I go to developper > states and I check the main sencor(Voron_V2_sensor), I get:

heater_bed:
  temperature: 55.02
  power: 0.22612467918242946
  target: 55
extruder:
  pressure_advance: 0
  target: 240
  power: 0.424405245237481
  can_extrude: true
  smooth_time: 0.04
  temperature: 240.35

So the connection to moonraker works and I get information. Then I do a value_template

voron_hotend_actual:
      device_class: temperature
      unit_of_measurement: '°C'
      value_template: >-
          {{ states.sensor.Voron_V2_sensor.attributes['extruder']['temperature'] | float | round(1) if is_state('sensor.Voron_V2_sensor', 'OK') else None }}

Before updating HA everything was working perfectly. Now after the last update voron_hotend_actual always gives me unknown. In fact all the voron sensors give me unknown. Also I have tested just the json inside value_emplate on developper > template and it gives me a number so I don’t know what to think. What could be my problem ?

entity_id’s don’t have capital letters in them. Verify that sensor.Voron_V2_sensor actually exists. If it does, make sure you access it with the correct characters and case.

This is my sensors.yaml

- platform: rest
  name: Voron_V2_sensor
  resource: "http://192.168.2.119:7125/printer/objects/query?heater_bed&extruder&print_stats&toolhead&display_status&virtual_sdcard"
  json_attributes_path: "$.result.status"
  json_attributes:
    - heater_bed
    - extruder
    - print_stats
    - toolhead
    - display_status
    - virtual_sdcard
  value_template: >-
      {{ 'OK' if ('result' in value_json) else None }}    
    #  Adding an API key is only necessary while using the [authorization] component
    #  and if Home Assistant is not a trusted client
  headers:
    x-api-key: 123456789abcdefghijklmno
      
- platform: template
  sensors:
    voron_hotend_target:
      device_class: temperature
      unit_of_measurement: '°C'
      value_template: >-
          {{ states.sensor.Voron_V2_sensor.attributes['extruder']['target'] | float | round(1) if is_state('sensor.Voron_V2_sensor', 'OK') else None }}
    voron_hotend_actual:
      device_class: temperature
      unit_of_measurement: '°C'
      value_template: >-
          {{ states.sensor.Voron_V2_sensor.attributes['extruder']['temperature'] | float | round(1) if is_state('sensor.Voron_V2_sensor', 'OK') else None }}

That doesn’t confirm the entity_id. You have to look in your entities list or the dev_tools → states page.

2 Likes

I just renamed everything on my sensors.yaml to lowercase and suddently everything works again. so you are right it was the lowercase Vs upperCase. Not sure why it worked in a previous HA release, but still renamming to lowercase solved the trouble.

Thanks a lot

1 Like