I have reported this as an issue on github, but since I get no response there, I’m trying here to see if anyone of all the very able community members have an idea how I can solve this issue.
I have the strangest issue:
I have created an AppDaemon app that takes energy prices from the NordPool integration and manipulates those data; among other things, decimating from quarterly hour to hourly prices and sorting from cheapest to most expensive hour.
As part of the manipulation process, I create the following list of data (among others):
self.stromprisRaw.append({"start": startTime, "end": endTime, "hour": self.hourNumber, "value": strompris})
where hour number (key hour) is 0 for the hour from midnight to 1 am, 1 for the hour from 1 am to 2 am, and so on.
I then write that list as an attribute to an energy price sensor like this:
self.set_state(self.args["sensorname"], \
state=round(self.strompris,4), \
attributes={'friendly_name': self.args["sensoralias"], \
'unit_of_measurement': 'NOK/kWh', \
'icon': 'mdi:currency-usd', \
'current_price': self.strompris, \
'ratio_current_to_average_today': self.nowtotoday, \
'offpeak1_today': self.offpeak1today, \
'offpeak2_today': self.offpeak2today, \
'peak_today': self.peaktoday,
'minimum_today': self.minimumtoday, \
'maximum_today': self.maximumtoday, \
'average_today': self.today, \
'offpeak1_tomorrow': self.offpeak1tomorrow, \
'offpeak2_tomorrow': self.offpeak2tomorrow, \
'peak_tomorrow': self.peaktomorrow, \
'minimum_tomorrow': self.minimumtomorrow, \
'maximum_tomorrow': self.maximumtomorrow, \
'average_tomorrow': self.tomorrow, \
'tomorrow_valid': self.tomorrow_valid, \
'stromstotteordning': self.stromstotteordning, \
'strompris': self.stromprisList, \
'strompris_today': self.stromprisTodayList, \
'strompris_tomorrow': self.stromprisTomorrowList, \
'raw_strompris': self.stromprisRaw, \
'raw_strompris_today': self.stromprisTodayRaw, \
'raw_strompris_tomorrow': self.stromprisTomorrowRaw, \
'sorted_strompris': self.stromprisRawSorted})
Up until, and including, AppDaemon version 17.10 (and for all versions prior to 17.10 - my app is 5-6 years old now), the raw_stromprisattribute (and other similar attributes) become as follows:
However, starting with version 17.11 (and continuing for every later version, currently version 18.5), the attribute becomes:
Note how hour: 0 has disappeared from the first item in the list (but is present for the subsequent items (1, 2, 3, …).
If I output the variable self.stromprisRaw to the AppDaemon log before writing it to the attribute, hour: 0 is present in the list, it’s just when it is written to the attribute that it is lost.
So I’m forced to still running AppDaemon v17.10…
Any ideas what’s going on here?
EDIT: Fixed images

