Home Assistant Community

How to trouble shoot this ERROR (MainThread) [homeassistant.helpers.service] Error rendering data template: UndefinedError: 'None' has no attribute 'state'

#1

Just upgraded to 0.93.
I’m getting this error but i have no idea where to start troubleshooting this:

2019-05-16 12:00:00 ERROR (MainThread) [homeassistant.helpers.service] Error rendering data template: UndefinedError: 'None' has no attribute 'state'

I found this, that apparently solves it, but i have no idea which template the error is referring too.

Any clues?

#2

It 's related to a template. Do you use it a lot for entities or automation ?
Have you change template recently ? Perhaps you have an entity not existing anymore or with a new entity_id and one of the template don’t find it anymore.

#3

I did a search within my config folder and found 134 occurances of value_template
:cry:

#4

Does it help by filtering the one with state keyword inside ?

#5

I cant thing of any clever wildcard to do this, but i believe that 99% of them would have the state keyword in them :frowning:

#6

They are some braking changes in 0.93 do you see some integration or platform linked to potential use of template and in the breaking change list ?

#7

Will check again with that scope in mind.
Nothing in there that i use, unfortunatelly.

Should i go remove my package folders and see if it goes away? and then find it by slowly restoring them?
Or is not worth the pain?

#8

Could it be that my vacuum takes too long to be set up?

It’s 12.46 atm, and didnt have any more occurances of the error.

#9

Perhaps activating debug level of logs generally can give you some clues on what home assistant is doing before rising the error.

#10

Great idea!, here are the ssh logs (# hassio ha logs):

2019-05-16 12:30:00 INFO (MainThread) [homeassistant.components.automation] Executing Irrigation Weather - Update average weather conditions every 30 mins
2019-05-16 12:30:00 INFO (MainThread) [homeassistant.helpers.script] Script Irrigation Weather - Update average weather conditions every 30 mins: Running script
2019-05-16 12:30:00 INFO (MainThread) [homeassistant.helpers.script] Script Irrigation Weather - Update average weather conditions every 30 mins: Executing step call service
2019-05-16 12:30:00 INFO (MainThread) [homeassistant.helpers.script] Script calculate_average_weather_conditions: Running script
2019-05-16 12:30:00 INFO (MainThread) [homeassistant.helpers.script] Script calculate_average_weather_conditions: Executing step call service
2019-05-16 12:30:00 ERROR (MainThread) [homeassistant.helpers.service] Error rendering data template: UndefinedError: 'None' has no attribute 'state'

Looks like my irrigation weather calculations are the issue :smiley:

Seems like dark_sky sensor

states.sensor.dark_sky_forecast_daytime_high_temperature_0

was changed to

states.sensor.dark_sky_forecast_daytime_high_temperature_0d

Let’s see if that fixes it :slight_smile:

#11

That was changed a version or 2 ago.

#12

¯_(ツ)_/¯…