Closed four2six closed 10 months ago
Hi @four2six, what a great idea to use the display for water levels!
The error is due to the sensor not containing the attribute today
, a primitive list with hourly data. All Nordpool sensors (each market has its own sensor) contain two lists, today
and tomorrow
. Each list have 24 values and the data rendered is taken from these two lists. It happens here in the code.
My code is made specifically for Nordpool electric forecast prices, i.e. look ahead in time from now and onwards. But as long as you have a sensor with n
number of values as a list you can throw pretty much anything in there.
I guess you are using some integration towards the https://wsv.de/ APIs? Is it related to this template? If you could provide me with some information about your setup I can try to figure out if there is enough data in the sensors somewhere to render a chart.
Hey thanks for your reply. The sensor is using the Pegel-online Integration.
It does have a history, but you're right, there's no array with values.
I think I can make it for you, I've found historical measurements in the API that should be fine to digest. You don't even have to use a sensor, it can be fetched directly from the python code. But it would be nice to have the sensor in HA too I suppose to be able to have the data in a HA dashboard. I will have a look at it later, should be easy to make it into HA.
Thanks! Looking forward to it.
I just tried throwing SENSOR = 'weather.home' at it with, i think that is the met.no sensor. I changed line 33 to
VALUES = (self.get_state(SENSOR, 'temperature')[HOUR_NOW::] + \
self.get_state(SENSOR, 'temperature'))[:24]
it does throw an error in line 33, TypeError: 'float' object is not subscriptable, so obviously it wants an array of strings?
Thanks! Looking forward to it.
I just tried throwing SENSOR = 'weather.home' at it with, i think that is the met.no sensor. I changed line 33 to
VALUES = (self.get_state(SENSOR, 'temperature')[HOUR_NOW::] + \ self.get_state(SENSOR, 'temperature'))[:24]
it does throw an error in line 33, TypeError: 'float' object is not subscriptable, so obviously it wants an array of strings?
No it has nothing to do with data type. Go back to my first reply, the sensor doesn't have the expected attributes.
@four2six, I have added a new class for you. You have to read the config in the header to make sure you get what you want out of it. This class renders the Köln Rhein water measurement, but it reduces the data to every fourth value (The API responds with data quarterly).
The chart is rendered historically, i.e. the last value is to the most left side and everything else has already happened. Therefore, the max/min values are also historical. The config value LEVEL_NORMAL
gives the possibility to remove empty space in the chart and everything above LEVEL_WARNING
will be red.
The file is named epaper_small_display_wsv_wasser.py and you have to add this to apps.yaml
:
epaper_small_chart_wsv_wasser:
module: epaper_small_display_wsv_wasser
class: SmallDisplayChartWsvWasser
EDIT: Forgot to mention, that the class creates a HA sensor for you. If you want it. And with that sensor you can use the data in "normal" HA as well.
hi Sven , great work, sorry to bother:
I get the error that my sensor is not existing, but it is....
my settings:
templating
gives me
any idea what's going on? It's happening with any sensor i choose.