This widget is similar to the influxdb graph widget that I posted earlier but this one reads the data directly from the Home Assistant database, so no need for influxdb. Compared to the influxdb graph widget, this one is a bit more limited and you cannot write custom SQL queries (not yet anyway).
I considered this, but the code is quite different for the two widgets, but Iāll give it a try. The reason is that the influxdb widget uses the OnStateAvailable event to start plotting, while the hagraph has to open a websocket to get something called āsigned pathsā to access the REST API so everything is async. Iāll have to figure out how to solve this. Possibly I could use different callbacks based on if it reads from HA or influxdb.
sorry i dont understand what you are asking to look for
do i need to look at the read me or the js?
in the readme i see you still use
hagraph_path: http://path_to_your_home_assistance_instance:8123 # will change name to base_url or similar
hagraph_token: YOUR_LONG_LIVED_ACCESS_TOKEN # Can be created through the Home Assistant front end.
instead off ha_url and ha_token
in the examples i see you use hagraph (and not graph)
and the needed options are not in the example (url and token)
i also see that you say: example dashboards for ā¦
that should be example widget definitions
i see your description to add other DBs. nice.
i think we will have to add an url to your readme after we have it in AD, because what you got in the readme is to extensive for the docs from AD at this point.
we would need a description in this style when it is implemented:
lock
A widget to monitor and activate a lock
Note that unlike HASS, Dashboard regards an unlocked lock as active. By contrast, the HASS UI shows a locked lock as āonā. Since the purpose of the dashboard is to alert at a glance on anything that is unusual, I chose to make the unlocked state āactiveā which means in the default skin it is shown as red, wheras a locked icon is shown as gray. You can easily change this behavior by setting active and inactive styles if you prefer.
Yes Rene, those were the comments I needed, no need to look at the code
Iāll use ha_url and ha_token and I guess graph is a suitable name for the widget. Iāll take some time to also read what the docs says about contributing widgets.
Ok, I think I saw something written about this, but that might have been a post by Andrew or you in the forum. I github collection for the custom widgets makes sense.
Iāve got everything just like the example. The only thing different is the sensor
mvp:
widget_type: hagraph
entities:
- sensor.temperatura_tendedero # The entity_id to be plotted.
units: "Ā°C" # The unit_of_measurement for your sensors/entities
titles:
- "Indoor temperature" # Title of the trace.
time: 24h # Time interval to plot. you can combine w, d, h and m as 2w1d3h20m (This would be 2 weeks, 1 day, 3 hours and 20 minutes)
title: "Temperatures" # Widget title
value_in_legend: 1
fill: "tozeroy" # options are "none" | "tozeroy" | "tozerox" | "tonexty" | "tonextx" | "toself"
colorIndex: 0 # A number between 0 and 11. 12 colors for the traces are predefined and the colorIndex defines
log: 1
# which is used for the first trace. If more than 12 traces/entities are specified, the colors are rotated.
graph_style: "border-radius: 0px; background-color: rgba(30,30,30,0.45 );" # Change to whichever css you like.
graph_legend_text_color: "#888888"
graph_grid_color: "#888"
graph_title_color: "#cccccc"
graph_x_axis_text_color: "#cccccc"
graph_y_axis_legend_color: "#cccccc"
graph_y_axis_text_color: "#cccccc"
graph_widget_style: "border-bottom-left-radius: 10px;border-bottom-right-radius: 10px;border-top-left-radius: 10px;border-top-right-radius: 10px;"
graph_trace_colors: "1" # Set the opacity for the trace colors.
graph_fill_colors: "1" # Set the opacity for the fill colors.
graph_bar_colors: "1" # Set the opacity for the bar colors.
graph_bar_multi: "1" # Leave this as is
graph_degrees_celsius_text: "Grados Celsius" # Adjust to your own language
graph_degrees_fahrenheit_text: "Grados Fahrenheit" # Adjust to your own language
graph_percent_text: "Porcentaje" # Adjust to your own language
hagraph_path: https://192.168.1.200:8123 # Adjust the port if needed.
hagraph_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYzY5NDI0NmY5YmM0ZTEwOGFjNzU0YTUzZDc5Zjg0MyIsImV4cCI6MTg2MjE3MzA4NiwiaWF0IjoxNTQ2ODEzMDg2fQ.KszD2dLsD_7LfNFi7X2LQyJq2Qv8kGEqCNUdLs2Xcae
OK, everything looks ok. I think itās an issue with ssl since you are using https. I donāt use https so I canāt try it now but if you want, you can try changing line 375 in basehagraph.js from
var url = "http://" + BASE_URL + path + filter
to
var url = "https://" + BASE_URL + path + filter
And see if it helps. It will not solve the websocket issue but it will solve another error you would receive once the websocket connecttion is working.
To fix the websocket issue you can try adding your network to trusted networks in your configuration.yaml for Home Assistant.
http:
trusted_networks:
- 192.168.1.0/24
You would then need to add this to the auth_providers section in configuration.yaml