I just started to publish some of my widgets. The first one is a graph widget that plots graphs of entities and uses influxdb as data source. This means that you need to have influxdb installed and configured in Home Assistant. See details here: https://www.home-assistant.io/components/influxdb/ The reason I am not reading the history from Home Assistant is that I wanted to be able to write more complex SQL queries, and using influxdb as data source is also much faster.
you state that i should have influxdb installed and configured in HA. would be helpfull if you would tell some more about that. in HA components i find infulxdb sensor and history. and history save all states to a db (which would make my DB extremely big in notime.
you have the db settings (these:
graph_influxdb_path: http://<URL_TO_YOUR_INFLUXDB_SERVER>:8086 # Example: 192.168.1.20:8086 or http://www.mydomain.com:8086
graph_influxdb_path_local: "http://<_LOCAL_URL_TO_YOUR_INFLUXDB_SERVER>:8086"
in the skin. to make the widgets more general it would be better to have those settings in the widget. that way the widget would work with every skin.
i think that it would be wise to put these
Copy influxdb-latest.js and plotly-latest.min.js /from the custom_css folder) to your custom_css folder
into a subfolder with your widget name. that would keep things more clear.
You can define which sensors and other entites are logged to the influxdb. I only log the entities I use for graphs so the db does not grow so big. There are also strategies for downsampling the time series in influxdb itself to reduce space of the db.
Yes, I considered moving the dependencies to a subfolder but in my setup, I use these dependencies also in other widgets, but for the purpose of publishing the widget, I will move it to a subfolder to make it more general as per your suggestion.
I had the influx_paths in the widget before, but moved it to the skins since I got tired of having to copy it to each widget definition, but you are right, it belongs in the widget parameters. I was looking for a way to put it in appdaemon.yaml but couldnāt find I way to access it from the widget. It would be nice to be able to access the ha config from widgets. That way you could read the setup straight from the configuration.
The first version of the widget actually read the data from the home assistant db, but the db grew to big for my taste and was to slow for long time series. I will consider adding an option to use home assistant for the data source since I already wrote the code.
for others it could be helpfull.
i dont use the DB from HA at all.
its hard to read anything from the HA config, because there is no fixed place for that and if it isnt in a sensor somewhere you cant read it out.
appdaemon.yaml is also not really the place for such settings.
you can suggest it as a setting in a skin and then still set it in the widget.
in that case i would present it as an empty string in the skin.
people then have a choice where they fill that info.
i found the blog and the component that is needed for influx db, but in your description it could be helpfull for others when you add links to the pages that are needed to install and configure influx.
I donāt know what I am doing wrong but I can seem to get the widget to show up in the dashboard. I can see the data in InfluxDB but the graph does show it is just blank and there is no error. Maybe this is a issue with appdaemon 3 has anyone tested this in this version?
Thanks tjntomas for the quick response i did the log and it look like it is getting blocked because i am using SSL on the HADashboard URL but the the link InfluxDB is not SSL looks like I either need to not use SSL or wait for a fix for the Hass.io addon to support SSL.
Aha! Ok, I havenāt enabled authentication on my server since I am not exposing it, but then I need to add basic authentication to the http request and it should work. Just to test, try adding
&u=YOUR_USER_NAME&p=YOUR_PASSWORD
to the url and see if authenticates. Then I will know how to implement it.
The login now works but still getting this on the screen. I got this error even when I donāt use the username password parameters and logged in on the prompt. So this might be a separate issue.