I hope someone can help me with what seems to be a small configuration problem.
I’ve searched and tried a number of things, but am unable to find and apply the info I need. I am a beginner.
I’ve bought a dragino LORA soil moisture and temperature sensor which communicates with TTN. IN HA the “The Things Network” integration receives data and HA automatically created sensor entities:
When using the entities in a dashboard I get the color bar instead of a graph.
Same as in this post, which I read when trying to fix it.
I then tried:
But this does not work as there is no place to enter either device_class or unit_of_measurement.
I think I need to edit either the configuration.yaml and/or the sensors.yaml and/or a template.yaml (although I understood from somewhere sensors.yaml might be reserved for binary sensors?)
but I am unable to find a working configuration with the right indentation.
My current config in configuration.yaml is:
Thanks for taking the time to answer me! Much appreciated.
I guess that’s what one gets when mucking about with old answers to more or less similar problems It was all me… I got lost.
Would sensors.yaml be the best place to move the code? Or is that file reserved for binary sensors (read that somewhere I think)
I got it working perfectly by copy/pasting your code. But after I tried adding code
for the battery in the same device I got an indentation error which I couldn’t fix. Now when I empty the file and copy/paste only your code it keeps throwing this error:
bad indentation of a mapping entry (20:28)
17 | state_class: "measurement"
18 | unit_of_measurement: °C
19 | sensor.se01_lb_001_water_soil:
20 | unit_of_measurement: %
---------------------------------^
21 | device_class: "moisture"
22 | state_class: "measurement"
When I remove the percentage sign the above file editor warning is gone and returns when I put it back. I’m so confused. I read somewhere the unit_of_measurement of moisture is percentage by default. Any Idea if that’s true?
What code are you talking about? If you are asking about the block I quoted… unless you have information that shows otherwise, I don’t believe it’s valid anywhere. There are no examples of anything like that in the documentation for the “The Things Network” integration.
What are you actually trying to achieve with the new sensor entities that won’t be achieved by using customize?
% should be the default unit of measurement… two options you can try:
Yes, what I posted was what you had posted as “My current config in configuration.yaml”, minus the invalid sensor configuration, and with the manual entity customization added.