just reading back.
in your variables.yaml
you didnt put quotes around the HA url and the token.
that can cause trouble.
Hi Tomas,
Hi Rene,
I added the quotes, but it didnt change the behaviour.
Just to be clear: I am using two seperat long living access tokens, one for HAGraph and one for AD.
Or do I have to use the AD-token in the variables.yaml?
I tried switching the path of the dashboards to /home/dashboards in the appdaemon.yaml.
Same behaviourā¦all Dashboards, except the Graphs-Dashboard is working.
Which .js file do you mean where I can add line by line? basehagraph.js?
Regards,
Christian
i would use the same token, but i dont think it matters.
yeah i would comment out everything in basegraph.js what could cause trouble, and then start re adding the code line by line untill it breaks.
Hi,
I am making progress, at least I can already see the Graph
But without curves right nowā¦
The problem was the unit.
This works:
mvp:
widget_type: hagraph
entities:
- sensor.current_temperature_bad_oben
units: "°C"
titles:
- "Bad oben"
time: 2h
title: "Temperaturen Heizung"
value_in_legend: 1
fill: "none"
log: 1
WRONG is unit: āĀ°Cā
Will try to fix the curves now.
Best regards,
Christian
Yes, same token is fine. I couldāt find a way to retrieve the token that appdaemon already have, thus the need to put it in the variables.
Hi Tomas,
Hi Rene,
dashboard compiled and now I finally get some messages in the console.
How can I solve the āInvalid Datetimeā error?
Thanks in advance,
Christian
time zone: Europe/Berlin application.js:3166:10
Local time is
Date Thu Nov 12 2020 16:13:04 GMT+0100 (MitteleuropƤische Normalzeit)
application.js:3168:10
12.11.2020 15:13:05 application.js:3556:11
Scheme http application.js:3474:11
12.11.2020 15:13:05 application.js:3556:11
Scheme http application.js:3474:11
12.11.2020 15:13:05 application.js:3556:11
Scheme http application.js:3474:11
12.11.2020 15:13:05 application.js:3556:11
Scheme http application.js:3474:11
Connected to Home Assistant application.js:3526:13
http://192.168.0.33:8123/api/history/period/12.11.2020T15:13ā¦-juyK-k&filter_entity_id=sensor.current_temperature_bad_oben application.js:3462:12
Connected to Home Assistant application.js:3526:13
XHRGEThttp://192.168.0.33:8123/api/history/period/12.11.2020T15:13:05?authSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI3NDY3ZjRjYjA0YWI0OWYxOGMzZjBkMzg5YzE3NGZiYiIsInBhdGgiOiIvYXBpL2hpc3RvcnkvcGVyaW9kLzEyLjExLjIwMjBUMTU6MTM6MDUiLCJpYXQiOjE2MDUxOTM5ODUsImV4cCI6MTYwNTE5NDAwNX0.URzjToMLRPR3MMba6GI4HeWYJPcxNL364hxq-juyK-k&filter_entity_id=sensor.current_temperature_bad_oben
[HTTP/1.1 400 Bad Request 39ms]
XHRGEThttp://192.168.0.33:8123/api/history/period/12.11.2020T15:13:05?authSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI3NDY3ZjRjYjA0YWI0OWYxOGMzZjBkMzg5YzE3NGZiYiIsInBhdGgiOiIvYXBpL2hpc3RvcnkvcGVyaW9kLzEyLjExLjIwMjBUMTU6MTM6MDUiLCJpYXQiOjE2MDUxOTM5ODYsImV4cCI6MTYwNTE5NDAwNn0.OYKenSjssMjNZRCOf-JFyRy0gfuo_C-pbkf1DTSqR8g&filter_entity_id=sensor.current_temperature_bad_unten
[HTTP/1.1 400 Bad Request 16ms]
http://192.168.0.33:8123/api/history/period/12.11.2020T15:13ā¦TSqR8g&filter_entity_id=sensor.current_temperature_bad_unten application.js:3462:12
Connected to Home Assistant application.js:3526:13
Object { message: "Invalid datetime" }
application.js:3462:12
Object { message: "Invalid datetime" }
application.js:3462:12
http://192.168.0.33:8123/api/history/period/12.11.2020T15:13ā¦SqR8g&filter_entity_id=sensor.current_temperature_wohnzimmer application.js:3462:12
XHRGEThttp://192.168.0.33:8123/api/history/period/12.11.2020T15:13:05?authSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI3NDY3ZjRjYjA0YWI0OWYxOGMzZjBkMzg5YzE3NGZiYiIsInBhdGgiOiIvYXBpL2hpc3RvcnkvcGVyaW9kLzEyLjExLjIwMjBUMTU6MTM6MDUiLCJpYXQiOjE2MDUxOTM5ODYsImV4cCI6MTYwNTE5NDAwNn0.OYKenSjssMjNZRCOf-JFyRy0gfuo_C-pbkf1DTSqR8g&filter_entity_id=sensor.current_temperature_wohnzimmer
[HTTP/1.1 400 Bad Request 16ms]
Connected to Home Assistant application.js:3526:13
Object { message: "Invalid datetime" }
application.js:3462:12
http://192.168.0.33:8123/api/history/period/12.11.2020T15:13ā¦R8g&filter_entity_id=sensor.current_temperature_schlafzimmer application.js:3462:12
XHRGEThttp://192.168.0.33:8123/api/history/period/12.11.2020T15:13:05?authSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI3NDY3ZjRjYjA0YWI0OWYxOGMzZjBkMzg5YzE3NGZiYiIsInBhdGgiOiIvYXBpL2hpc3RvcnkvcGVyaW9kLzEyLjExLjIwMjBUMTU6MTM6MDUiLCJpYXQiOjE2MDUxOTM5ODYsImV4cCI6MTYwNTE5NDAwNn0.OYKenSjssMjNZRCOf-JFyRy0gfuo_C-pbkf1DTSqR8g&filter_entity_id=sensor.current_temperature_schlafzimmer
[HTTP/1.1 400 Bad Request 16ms]
Object { message: "Invalid datetime" }
EDIT:
Got it running with the following line at the end of basehagraph.js
return today.toLocaleDateString("sv-SE") + "T" + today.toLocaleTimeString("sv-SE")
yeah.
sometimes its just 1 freaking character breaking everything.
i guess AD wasnt able to translate that and broke on it while compiling.
Thanks again both of you.
I am pretty happy with my dashboard now
Best regards,
Christian
Hi Tomas,
Hi Rene,
next day, next challenge
I noticed, that there is a 1 hour shift in my Graph data and also there is some data missing, although there is data of the sensor in Homeassistant. Please the following pictures.
Do you have any idea how to solve this?
Thanks in advance,
Christian
Hi, I havnāt seens these missing data before, strange. Try adding in the config for the widget:
samples: 100
ds: 15m
Which timezone are you in? We solved the time issue for another poster here, Iāll look it up.
Can you try clicking, single and double, on the legends (the lines with text at the bottom). It should toggle the individual traces off and on. See if it makes any diffrence. It will give me some hints.
Also try zooming in on the missing data points by dragging a square around them with the pointer.
your dashboards are working, so im out of the picture. i let you 2 figure it out
Hi Tomas,
the parameters samples/ds doesnt seem to change anything.
I also tried different values, but couldnt see a difference.
My timezone is Europe/Berlin.
Right now I am using the following settings (which seem to result in the 1 hout time delay):
[...]
self.TIME_ZONE = Settings(self, 'time_zone','Europe/Berlin')
self.LOCALE = Settings(self, 'locale','de')
console.log("time zone:", self.TIME_ZONE)
var now = new Date()
console.log("Local time is", now)
[...]
console.log(today.toLocaleDateString(self.LOCALE), today.toLocaleTimeString(self.LOCALE))
return today.toLocaleDateString("sv-SE") + "T" + today.toLocaleTimeString(self.LOCALE)
Appdaemon time is correct (looked it up in the logs).
Homeassistant time is also correct and the same as Appdaemon.
Regarding the missing data it might be that there is data missing because of restarting my PI/Homeassistant all the time when I was trying to solve the Graph-Problem. But there are definetly timespots where Homeassistant shows data and the graph is not.
By the way: Firefox is not able to show the Graph. There is an Error in the console:
Uncaught TypeError: DataSeries[((i * 2) + 1)] is undefined
Not a big deal, because I use Wall Panel App on my tablet and with GoogleChrome there is no Error, but maybe it has something to do with the missing data/time zone problem??
Edit:
Clicking, single and double, on the legends is working as expected but the missing data is still missing.
Best regards,
Christian
It seems I am using a slightly updated version that i didnāt upload, and I donāt have time to write up all the changes now, but if you donāt mind editing a line in basehagraph.js, you can fix the gaps as follows:
Goto line 248 and add connectgaps: true,
as per below. Recompile and it should be fine.
type: Settings(self,'type',"scatter"),
x: DataSeries[i * 2],
y: DataSeries[i * 2 + 1],
connectgaps: true, // Add this line, don't forget the comma.
Something to consider:
You will lose all your data if your HA database gets corrupted, so you might want to look into storing the data that you want to keep over time in influxdb. There is a corresponing HADashboard widget using influxdb also. There are some more options available there since I can write actual sql querys against influxdb. I use this and I can group and sum traces such as getting the daily/weekly energy consumption from a continuous measure.
I havenāt figured this out, but on the next data update the widget receives from HA, it will draw the plot. A dirty fix would be to identify if the browser is firefox and just render the graph twice when it loads.
Leave the browser open in Firefox for a while and see.
Here is the dirty fix (Draws the plot twice on load, no browser checking since its better to find the real issue) : Firefox fix for HADasboard graph widget - Pastebin.com It also solves the connectgaps issue.
Hi Tomas,
Adding the " connectgaps: true," part in my own basehagraph.js did not seem to change anything.
I tried using your code from the last post, but when I replace it with my own file, the dashboard isnt loading anymore. Appdaemon log says:
`2020-11-15 21:42:54.726179 INFO AppDaemon: function [get_dashboard] finished in 872 ms
2020-11-15 21:42:54.705975 WARNING AppDaemon: ------------------------------------------------------------
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 3620: invalid start byte
(result, consumed) = self._buffer_decode(data, self.errors, final)
File "/usr/lib/python3.7/codecs.py", line 322, in decode
js = fd.read()
File "/usr/local/lib/python3.7/dist-packages/appdaemon/dashboard.py", line 725, in _get_widgets
widgets = self._get_widgets()
File "/usr/local/lib/python3.7/dist-packages/appdaemon/dashboard.py", line 629, in _get_dash
dash = self._get_dash(name, skin, skindir)
File "/usr/local/lib/python3.7/dist-packages/appdaemon/dashboard.py", line 817, in _conditional_compile
dash = self._conditional_compile(name, skin, recompile)
File "/usr/local/lib/python3.7/dist-packages/appdaemon/dashboard.py", line 863, in get_dashboard
2020-11-15 21:42:54.705155 WARNING AppDaemon: Traceback (most recent call last):
2020-11-15 21:42:54.703822 WARNING AppDaemon: ------------------------------------------------------------
2020-11-15 21:42:54.703062 WARNING AppDaemon: Unexpected error during DASH creation
2020-11-15 21:42:54.702222 WARNING AppDaemon: ------------------------------------------------------------
2020-11-15 21:42:54.700808 INFO AppDaemon: Loading custom widget 'basehagraph'
2020-11-15 21:42:54.699849 INFO AppDaemon: Loading custom widget 'hagraph.yaml'
2020-11-15 21:42:54.698648 INFO AppDaemon: Loading custom widget 'weatherentity.yaml'
2020-11-15 21:42:54.696540 INFO AppDaemon: Loading custom widget 'base_weatherentity'
2020-11-15 21:42:53.879392 INFO AppDaemon: Compiling dashboard 'extheating'`
My biggest problem right now arent the gaps and the firefox-problem. Regarding the gaps right now I think its a combination of restarting my PI with Homeassistant and connection loss of my sensors to Homeassistant because of low batterie. I changed all battieries now and will have a look if there are still gaps.
My last problem is, that I still have a one hour time shift in my graph like postet here:
Of course I tried your tips there but they didnt solve the problem.
I also tried different timezones āde-DEā āsv-SEā even one for Belarus or Russia, but they didnt help. The timestamp in the link when he tried to get the data from homeassistant is correct, but when i compare the graph with the Data of homeassistant there is a shift. You can see that shift in the pictures some posts before.
Is the data somhow stored wrong in my HA-Database or is the Graph using the correct data wrong?
Best regards,
Christian
the data is probably stored something like +01:00
and its the translated back to a datetime object without looking at the addition.
a quick and dirty solution is just adding or substracting 1 hour from the time. (which will probably fail in the summertime again)
Hi Tomas,
Hi Rene,
I learned, that Homeassistant is storing in UTC-Time in the database. So actually if I make an API-Call at 19:39 local german time, he is looking in the Database for 18:39 UTC time. So thats no mistake i guess:
Console output:
time zone: Europe/Berlin
application.js:3168 Local time is Mon Nov 16 2020 19:44:49 GMT+0100 (MitteleuropƤische Normalzeit)
application.js:3557 2020-11-15 19:44:50
application.js:3475 Scheme http
application.js:3557 2020-11-15 19:44:50
application.js:3475 Scheme http
application.js:3557 2020-11-15 19:44:50
application.js:3475 Scheme http
application.js:3557 2020-11-15 19:44:50
application.js:3475 Scheme http
application.js:3527 Connected to Home Assistant
application.js:3463 http://192.168.0.33:8123/api/history/period/2020-11-15T19:44:50?authSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI3NDY3ZjRjYjA0YWI0OWYxOGMzZjBkMzg5YzE3NGZiYiIsInBhdGgiOiIvYXBpL2hpc3RvcnkvcGVyaW9kLzIwMjAtMTEtMTVUMTk6NDQ6NTAiLCJpYXQiOjE2MDU1NTIyODksImV4cCI6MTYwNTU1MjMwOX0.ytgf_Tj2MUILgYeCdXelA_veckadX7pRadEuRDfTTes&filter_entity_id=sensor.current_temperature_bad_oben
application.js:3463 [Array(15)]
3application.js:3527 Connected to Home Assistant
application.js:3463 http://192.168.0.33:8123/api/history/period/2020-11-15T19:44:50?authSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI3NDY3ZjRjYjA0YWI0OWYxOGMzZjBkMzg5YzE3NGZiYiIsInBhdGgiOiIvYXBpL2hpc3RvcnkvcGVyaW9kLzIwMjAtMTEtMTVUMTk6NDQ6NTAiLCJpYXQiOjE2MDU1NTIyODksImV4cCI6MTYwNTU1MjMwOX0.ytgf_Tj2MUILgYeCdXelA_veckadX7pRadEuRDfTTes&filter_entity_id=sensor.current_temperature_bad_unten
application.js:3463 [Array(24)]
application.js:3463 http://192.168.0.33:8123/api/history/period/2020-11-15T19:44:50?authSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI3NDY3ZjRjYjA0YWI0OWYxOGMzZjBkMzg5YzE3NGZiYiIsInBhdGgiOiIvYXBpL2hpc3RvcnkvcGVyaW9kLzIwMjAtMTEtMTVUMTk6NDQ6NTAiLCJpYXQiOjE2MDU1NTIyODksImV4cCI6MTYwNTU1MjMwOX0.ytgf_Tj2MUILgYeCdXelA_veckadX7pRadEuRDfTTes&filter_entity_id=sensor.current_temperature_wohnzimmer
application.js:3463 [Array(23)]
application.js:3463 http://192.168.0.33:8123/api/history/period/2020-11-15T19:44:50?authSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI3NDY3ZjRjYjA0YWI0OWYxOGMzZjBkMzg5YzE3NGZiYiIsInBhdGgiOiIvYXBpL2hpc3RvcnkvcGVyaW9kLzIwMjAtMTEtMTVUMTk6NDQ6NTAiLCJpYXQiOjE2MDU1NTIyODksImV4cCI6MTYwNTU1MjMwOX0.ytgf_Tj2MUILgYeCdXelA_veckadX7pRadEuRDfTTes&filter_entity_id=sensor.current_temperature_schlafzimmer
API-request:
http://192.168.0.33:8123/api/history/period/2020-11-15T19:44:50?authSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI3NDY3ZjRjYjA0YWI0OWYxOGMzZjBkMzg5YzE3NGZiYiIsInBhdGgiOiIvYXBpL2hpc3RvcnkvcGVyaW9kLzIwMjAtMTEtMTVUMTk6NDQ6NTAiLCJpYXQiOjE2MDU1NTIyODksImV4cCI6MTYwNTU1MjMwOX0.ytgf_Tj2MUILgYeCdXelA_veckadX7pRadEuRDfTTes&filter_entity_id=sensor.current_temperature_bad_unten
[[{"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "e4111788934749949c6178163585ffc3", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-15T18:44:50+00:00", "last_updated": "2020-11-15T18:44:50+00:00", "state": "17.0"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "4117f3128ade40d1b836f94f820f2882", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-15T19:05:47.096993+00:00", "last_updated": "2020-11-15T19:05:47.096993+00:00", "state": "None"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "1c84f3e70b9e4ede889d4353c80ef3dc", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-15T19:06:32.585783+00:00", "last_updated": "2020-11-15T19:06:32.585783+00:00", "state": "17.0"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "bbcf52acc7f946379c59c3af31467181", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T03:28:45.115663+00:00", "last_updated": "2020-11-16T03:28:45.115663+00:00", "state": "18.5"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "3c605039ffcd4c4a91963c57562b075a", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T03:43:00.161222+00:00", "last_updated": "2020-11-16T03:43:00.161222+00:00", "state": "19.0"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "02ac44ccc74043a48da4cabfc41211a0", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T04:01:17.634449+00:00", "last_updated": "2020-11-16T04:01:17.634449+00:00", "state": "19.5"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "bf8e7de4468a4656857fbc7deadeb6ec", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T05:16:31.662979+00:00", "last_updated": "2020-11-16T05:16:31.662979+00:00", "state": "21.0"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "d189e99f67484bd7b83144851548aa07", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T05:30:44.124675+00:00", "last_updated": "2020-11-16T05:30:44.124675+00:00", "state": "22.0"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "6430e9032ff64cf09e3401188570e4e9", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T06:30:42.595315+00:00", "last_updated": "2020-11-16T06:30:42.595315+00:00", "state": "22.5"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "7585ff40367a4cd8b3db9e0bb3247b54", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T06:49:00.571973+00:00", "last_updated": "2020-11-16T06:49:00.571973+00:00", "state": "23.0"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "a1c1e1a9d86b4b0198b845cb5ec4314d", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T07:18:31.224745+00:00", "last_updated": "2020-11-16T07:18:31.224745+00:00", "state": "22.0"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "8ebb64d79abd45c0b80a6eae942ce246", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T07:34:46.096085+00:00", "last_updated": "2020-11-16T07:34:46.096085+00:00", "state": "21.0"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "4abf37a6622d43a1bb954eb774312244", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T07:49:00.089804+00:00", "last_updated": "2020-11-16T07:49:00.089804+00:00", "state": "20.5"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "7a44f7b3cc1a417f899e3b33fdd17bdb", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T08:05:16.659831+00:00", "last_updated": "2020-11-16T08:05:16.659831+00:00", "state": "20.0"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "e21f66af7ba346a0940d92567671ba04", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T08:34:46.189607+00:00", "last_updated": "2020-11-16T08:34:46.189607+00:00", "state": "19.5"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "f0830d1dec7a4805b7f27442d65c89bd", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T08:48:58.586554+00:00", "last_updated": "2020-11-16T08:48:58.586554+00:00", "state": "19.0"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "eb31eab809f94f7ba7b88221dbe0121f", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T09:34:45.145633+00:00", "last_updated": "2020-11-16T09:34:45.145633+00:00", "state": "18.5"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "9d3c447182754a37a3240da6f2eea28c", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T10:48:56.599859+00:00", "last_updated": "2020-11-16T10:48:56.599859+00:00", "state": "18.0"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "d2427581524747808461b0f6676bde45", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T15:19:20.107469+00:00", "last_updated": "2020-11-16T15:19:20.107469+00:00", "state": "17.5"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "80d332d6ab98423aaffac300e264e0e7", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T16:39:59.139671+00:00", "last_updated": "2020-11-16T16:39:59.139671+00:00", "state": "unknown"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "89c50698bfaa438fb7160ad9751e12c2", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T16:40:04.249311+00:00", "last_updated": "2020-11-16T16:40:04.249311+00:00", "state": "17.5"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "139d9361923048f1957090e4df642acc", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T16:42:36.373441+00:00", "last_updated": "2020-11-16T16:42:36.373441+00:00", "state": "unknown"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "dda9cad3d78b4697bd46b25e4e831ff6", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T16:42:41.377343+00:00", "last_updated": "2020-11-16T16:42:41.377343+00:00", "state": "17.5"}, {"attributes": {"friendly_name": "Temperatur Bad unten"}, "context": {"id": "ea4e1582c0a7461c9b0316f77f184054", "parent_id": null, "user_id": null}, "entity_id": "sensor.current_temperature_bad_unten", "last_changed": "2020-11-16T18:19:13.127671+00:00", "last_updated": "2020-11-16T18:19:13.127671+00:00", "state": "18.0"}]]
The thing is, that the history tab of HA is automatically converting the UTC-database times to the local time set in the configuration.yaml.
Is there a way to achieve this with the graphs widget?
If not, how would a quick and dirty 1hour adding/substracting look like (I have no idea where to do this in the script).
Even if i learned a lot about HA/Appdaemon and scripting now, I am a little bit frustrated cause its so time consumingā¦
Regards,
Christian
I added a timeshift function earlier. Iāll look up the code and post it.
Replace the HA_Data function with the below and let me know if it works,
function HA_Data(self, values, index){
values = values[0]
self.DataSeriesArray[index*2] = new Array ()
self.DataSeriesArray[index*2+1] = new Array ()
for (data in values){
self.DataSeriesArray[index*2+1].push(parseFloat(values[data]['state']))
var dt = new Date(values[data]['last_changed']) // Read the datetime string into a date object
dt.setHours( dt.getHours() + 1 ); // Add one hour offset.
self.DataSeriesArray[index*2].push(dt) // Add to trace data.
}
if (index == self.number_of_entities){
MultiPlot(self, self.DataSeriesArray)
}
}
Hi Tomas,
thank you very much!
I dont understant it, BUT:
I added your code with " dt.getHours() + 1" insideā¦and it was one hour wrong.
I changed +1 to +0 and now its fixed??
As I understand your script it is there to introduce a timeshift.
I dont understand, why its working with +0, but its working
Thanks and regards,
Christian