#yeah ```state class measurement```

1 messages · Page 1 of 1 (latest)

spark shuttle
#

Cannot quick reload all YAML configurations because the configuration is not valid: Invalid config for [sensor.template]: [state_class] is an invalid option for [sensor.template]. Check: sensor.template->sensors->temp_heater_bedroom->state_class. (See ?, line ?).

#

i get the error

crimson agateBOT
#

Please use a code share site to share code or logs, for example:

Please don't use Pastebin, since it can randomly add spaces to the main view. Please also don't share text as images since it makes it harder for people to help you. Remember that others may have colour blindness, impaired vision, etc.

spark shuttle
#

when i add state_class: measurement

woeful obsidian
#

Yeah use dpaste and give us your code please

fair quartz
#

You need to use a new style template sensor

spark shuttle
#
  sensors:
    temp_heater_bedroom:
      unique_id: temp_heater_bedroom
      unit_of_measurement: "°C"
      state_class: measurement
      value_template: "{{ states.climate.heater_bedroom.attributes.current_temperature }}"
crimson agateBOT
#

@spark shuttle To format your text as code, enter three backticks on the first line, press Shift+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.

fair quartz
#

That's the old style, it doesn't support ... many things

woeful obsidian
#

It's just unfortunate that lots of examples exist of the old way

fair quartz
#
template:
  - sensor:
      - name: "temp_heater_bedroom"
        unique_id: temp_heater_bedroom
        unit_of_measurement: "°C"
        state_class: measurement
        state: "{{ state_attr('climate.heater_bedroom','current_temperature') }}"
spark shuttle
#

I do not really see the difference

woeful obsidian
#

If you've got the code under a sensor.yaml include you'll need to move it too

spark shuttle
#

I do

#

Where should it be?

woeful obsidian
#

Yeah using templates for sensors vs making sensors under templates

#

It's a subtle but very important diff

spark shuttle
#

Ah ok

#

I try that then

woeful obsidian
#

The old way lacks many features because it's no longer maintained

spark shuttle
#

dont want that. So i just make a template.yaml file and link it in the main config file?

spark shuttle
#

Hei, so now i have the same functionality, just that its moved into template.yaml

#

but still no temp on the area card

woeful obsidian
#

Is it a card that's automatically including stuff marked for that area?

spark shuttle
#

Yeah

woeful obsidian
#

And the sensor is still in the correct area after re-creating it?

spark shuttle
#

Yes, i just doubled checked. I have also restarted HA

#

Data is flowing nicely

#

Just doesnt get there. Its like it does not register it as a temp measuring device

woeful obsidian
#

Hmm, I tried it with my own template sensor and it's not showing for me either

#

I think you found a bug haha

#

If you've got HACS, check out the minimalist area card, it's got a lot more options

spark shuttle
#

Should i report the bug somewhere?

#

I will try that

#

I think that area card is the solution. It worked as expeceted and they were a bit slimmer, which is nice'

#

I think i will fix that, but not today.