Hi,
I’m new to HA and wish to create a sensor that will use a json file as it’s input.
I’ve read articles about creating the sensor (new directory ‘sensor’, add a yaml file, etc) and have done that.
I restart HA but there is no sign of the new sensor anywhere, nor can I see any errors but tbh I’m probably not looking in the right place.
Is there a detailed guide, head to toe, of how to write a sensor, add it to a dashboard, test it via a console, etc please?
There are lots of snippets of info within this community but when starting out I really need a guide to help get me started.
Check the Log for related errors and post the sensor configuration you created.
The documentation shows how to compose a Template Sensor’s YAML configuration.
Entities are automatically added to the auto-generated dashboard. If you have a created a custom dashboard, you must manually add the entity using whichever card you prefer.
The only part of a Template Sensor’s configuration you can test in the Template Editor is the template.
I’ve now added it, checked the config, reloaded the config, and checked Log but still no mention of the sensor. It also doesn’t show in the dropdown list when I edit a Dashboard.
Thanks Taras, restarted the entire box but still no mention in the Log or the sensor showing in the dropdown.
I’m suspecting that it’s not loading the new config files - is there any way of checking what its loading?
Found the issue: It’s ignoring the yaml file because I come from a Ruby world and had used a .yml suffix.
It’s now loading the file and failing with a config error.
Thanks for your patience - in the words of Arnie “I’ll be back” I’m sure lol
The error was to do with json. Ive changed the type to .txt (data file) for now and can read the sensor.
The next issue is on the sensor card in my trial Dashboard the lines plots upside down - as the sensor returns a higher value the line descends, lower values and it rises.
I’m going to see if I need to set the device_class to monatory next to fix it.
Json sorted but the chart is still inverted - except when you click it to see the history. That popup chart is just what I would like in the card but there doesn’t seem to be one available built in.
Is it possible to have the history style of chart on the card please?
The chart is showing an initial price of 95 followed by a change to 69.