Hi, most probably it is a newbie question but please help as I made few templates accordingly (in my opinion) to docs - also for Attributes add-on, and no one is working.
I am trying to obtain a sensor for attribute current_temperature for climate.netatmo_bedroom. I did tried following ones and everyone did end with error. The question is where are the errors?
There is no attribute platform that I know of. Where is this documented? Also you specified “entities” instead of “entity_id”. Use the template platform and:
Again, looks ok, though this is not the best format to use. The format you used in 3. was better as it does not error if the climate component is unavailable, say right after a restart. What was the error?
Invalid config for [sensor]: required key not provided @ data['platform']. Got None. (See /config/configuration.yaml, line 18). Please check the docs at https://home-assistant.io/integrations/sensor/
4
other sensors do works with this space, without that space I do have an error in previous sensors
Error loading /config/configuration.yaml: while parsing a block mapping
in "/config/sensors.yaml", line 2, column 1
expected <block end>, but found '-'
in "/config/sensors.yaml", line 47, column 1
RMRK: Problem found @tom_l I did have sensor line in one of the first rows (for systemmonitor, strange it works [or I didn’t notice]). It occurs in process of switching from configuration.yaml to sensors.yaml
Thanks for cooperation it really helped not only in this case but also for future.
I think this topic could be deleted (as a newbie no idea if it is possible/doable/expected). Anyway thanks and like I learned about at least about quotations that was not clear for me.
Saves writing the same template over and over again. I use that custom component to monitor anything with batteries battery level, and when I get another device I just add the entity id to the bottom of the list.
The custom component’s first example shows a single sensor that monitors several batteries. Adding another device to an equivalent Template Sensor would simply be a matter of adding its entity_id to the template.
As for QbaF’s use of the custom component, it is monitoring temperature which, as shown above, is easily handled by a Template Sensor.
I do understand the custom component’s appeal (convenience; avoids writing a template). Nevertheless, the job can be done with a Template Sensor and the result may even be more compact (and certainly more flexible).
That configuration you’ve shown creates one sensor or four sensors (one for each of the four entities listed)?
EDIT
If it generates four separate sensors, then I understand its benefit. It simplifies the configuration of multiple sensors that share a common functionality (temperature, battery_level, etc).
would have loved to have known of this before, I have a huge amount of template sensors that brake out all attributes of the binary_sensors the Hue custom component makes… Will certainly try out this.
Would be even cooler if we could set a list of attributes like:
- platform: attributes
friendly_name: battery # (this would be an issue, could be made temptable maybe)
attribute: battery, lux, light_level, dark, reachable, on
icon: 'mdi:battery' #(as would this)
entities:
- binary_sensor.hue1
- binary_sensor.hue
- binary_sensor.hue
- binary_sensor.hue
breaking out all of these:
cant find it in the docs, but would you know if that could be done?
If not, ill create a feature request.
This sole component would save me a few hundred lines of identical templates… (for 13 of these sensors.)
@123 Four sensors, the friendly name bit is tagged on the end of the friendly name of the original sensors. Works really well.
@Mariusthvdb AFAIK it’s one attribute per sensor, but you could use yaml anchors to create as many as you want with very few extra lines or add a feature request