Iāam not able to figure out how i can access the attributes of that sensor in grafana.
I suppose (fear), that i have to āconvertā the attributes i wish to use to a new / extra sensor. Is that true? If so how can i do that for example for the attribute ābytes_receivedā? And what do i have to arrange to have this information stored in the recorder?
Or do i miss here something and the attributes are there, but i simply do not find out?
Do i have to arrange something so that this information is regulry written via recorder into the database? Or does that simply work as soon as i created a sensor / template?
Whenever the entities in the templates update the template sensor updates and is recorded in the database. All automatic. You donāt need to do anything.
If you supply the entity_id of the sensor Iāll show you an example you can use.
The second two are sensors, if you give them a unit you can graph them. I chose to convert bytes to megabytes but you could use anything you want, bytes, kilobytes, gigabytes, etc⦠just by changing the the template divisor.
I also rounded the result to two decimal places. Again, feel free to change this.
The |int filter is used to change strings to integers (so we can do division). It may not be required. Attributes can have other types that just string where as states are always strings.
Invalid config for [sensor.template]: invalid template (TemplateSyntaxError: unexpected ')') for dictionary value @ data['sensors']['bytes_received']['value_template']. Got "{{ (state_attr('sensor.fritzbox_internet', 'bytes_received')|int / 1024)|round(2)) }}". (See ?, line ?).`
I changed it one more time and compared the original sensor and itās attributes and the new four sensors based on them.
I then found another problem: wie missed to add āsensor.ā to the sensor name where the new ones are based on: sensor.fritzbox_internet
So now i have the following for the binary sensors
And everything works! Including the rounding Doublechecked. The values of the new sensors reflect the attributes of the main sensor in the development panel.
Hate to dig up a really old thread⦠but Iām having a similar issue trying to map an attribute and Iāve gone through templates but Iām just not getting it.
Iāve managed to map the attribute to an entity card configuration and have the attribute value showing that way, but I canāt seem to get the attribute to list in grafana.
Then, I try to get the value into grafana, and I canāt make it populate. This is the select statement code when I switch from what Iāve mapped in visual editor:
SELECT mean(āvalueā) FROM āautogenā.ā%ā WHERE (āentity_idā::tag = āstorage_cā) AND $timeFilter GROUP BY time($__interval) fill(null)
Obviously, I donāt have the attribute defined anywhere there but I canāt figure out the syntax to define it.
Any help, very much so appreciated. If you require more information please let me know.