Lots off errors by templatesensor

i tried:

warnings: off
warnings: ‘off’
warnings: Off

by the templatesensors i have (quite a few)

but i keep getting errors like this:

16-08-11 22:21:11 homeassistant.components.sensor.template: UndefinedError: 'None' has no attribute 'attributes'

and like this:

16-08-11 22:21:12 homeassistant.core: WorkerPool:Current job from 2016-08-11T22:21:11.998039+02:00: (<function SensorTemplate.__init__.<locals>.template_sensor_state_listener at 0x04994300>, <Event state_changed[L]: entity_id=sensor.huiskamer_verlichting, old_state=<state sensor.huiskamer_verlichting=unknown; icon=mdi:power, friendly_name=Verlichting gaat aan @ 2016-08-11T22:21:08.386923+02:00>, new_state=<state sensor.huiskamer_verlichting=19:54; icon=mdi:power, friendly_name=Verlichting gaat aan @ 2016-08-11T22:21:11.966790+02:00>>)

i know its just a warning that te sensorvalue wasnt set before, but it makes the log unreadable.

is there anyone who can tell me what to do with this?

Could you find out which one it is that is causing this and post the config entry of that sensor?

I have the same issue. I have a template sensor that get’s filled through a 433Mhz sensor by looking at the attribute fields of that sensor (Batterylevel). But it takes a while before the first data from the 433Mhz sensor comes in. And thus HASS is whining that the template sensor can’t find the attribute in the 433Mhz sensor when i restart HASS.

But it is a known issue and there is already a issue created for it: https://github.com/home-assistant/home-assistant.io/issues/767
So i would advise to watch that issue.

thx, @ThinkPad

i’m quite sure thats the same problem.

i have templates based on the sun (gets set after the errors), mysensors (also) and devices.
all off them are none if the templates are set as it seems.

i hope thats corrected soon, because its really annoying.

You can get rid of the UndefinedError entries in the log, by setting up your templates a little differently. You can find out how in my post here.

However, I have no idea how to get rid of the WorkerPool entries in the log, if it’s even possible at all. They seem to be purely informational, so I could do without them too.

1 Like

thx. @fanaticDavid

it helps a tiny bit.

the workerpool entrys are all that is left and thats the biggest part.

i have set the logger to error and the components part i set to info.

gives a way better info and i can Always set the components part to a higher level if i like.

at least all the workerpool shit is gone.

What did you guys configure for the logger component? maybe you could blacklist that one component?

is not just 1 component.
its template, input_boolean, mysensors, etc.

logger:
  default: error
  logs:
    homeassistant.components: info
    homeassistant.components.device_tracker: warn

this keeps me away from all the shit in the moment.
it seems like that if i dont have that in lots off info shows up what shouldnt show up.

all the workerpool info is just info like … set from NONE to … or from … to …
only during startup.

The warning parameter was never implemented in the code, and is now removed from the documentation.
The entity_id parameter was instead added for this purpose and should work.

and what if there are none or several entities in the value_template?

@ReneTode:

      entity_id: 
       - input_slider.alarmhour
       - input_slider.alarmminutes

it still gives lots of things in the errorlog:


sensor 3:
  platform: template
  sensors:
    licht_raamkozijn:
      friendly_name: Lichtst. raamkozijn (legohuis)
      value_template: '{{ states.sensor.arduino2_3_101.state }}'
      unit_of_measurement: ' '
      entity_id: 
        - sensor.arduino2_3_101
16-08-13 13:22:10 homeassistant.core: WorkerPool:All 5 threads are busy and 16 jobs pending
16-08-13 13:22:10 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:22:08.337291+02:00: (<function load_platform.<locals>.discover_platform at 0x0407A930>,)
16-08-13 13:22:10 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:22:08.337291+02:00: (<function load_platform.<locals>.discover_platform at 0x0407A978>,)
16-08-13 13:22:10 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:22:08.337291+02:00: (<function load_platform.<locals>.discover_platform at 0x0407A8E8>,)
16-08-13 13:22:10 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:22:08.337291+02:00: (<function load_platform.<locals>.discover_platform at 0x0407A9C0>,)
16-08-13 13:22:10 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:22:10.766217+02:00: (<function SensorTemplate.__init__.<locals>.template_sensor_state_listener at 0x052E64B0>, <Event state_changed[L]: old_state=None, new_state=<state sensor.licht_raamkozijn=; friendly_name=Lichtst. raamkozijn (legohuis), icon=mdi:lightbulb, unit_of_measurement=  @ 2016-08-13T13:22:10.766217+02:00>, entity_id=sensor.licht_raamkozijn>)
16-08-13 13:22:10 homeassistant.core: WorkerPool:All 5 threads are busy and 31 jobs pending
16-08-13 13:22:10 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:22:08.337291+02:00: (<function load_platform.<locals>.discover_platform at 0x0407A930>,)
16-08-13 13:22:10 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:22:08.337291+02:00: (<function load_platform.<locals>.discover_platform at 0x0407A978>,)
16-08-13 13:22:10 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:22:08.337291+02:00: (<function load_platform.<locals>.discover_platform at 0x0407A8E8>,)
16-08-13 13:22:10 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:22:08.337291+02:00: (<function load_platform.<locals>.discover_platform at 0x0407A9C0>,)
16-08-13 13:22:10 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:22:10.797468+02:00: (<function SensorTemplate.__init__.<locals>.template_sensor_state_listener at 0x052E68E8>, <Event state_changed[L]: old_state=None, new_state=<state sensor.licht_raamkozijn=; friendly_name=Lichtst. raamkozijn (legohuis), icon=mdi:lightbulb, unit_of_measurement=  @ 2016-08-13T13:22:10.766217+02:00>, entity_id=sensor.licht_raamkozijn>)
16-08-13 13:22:10 homeassistant.core: WorkerPool:All 5 threads are busy and 61 jobs pending
16-08-13 13:22:10 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:22:08.337291+02:00: (<function load_platform.<locals>.discover_platform at 0x0407A930>,)
16-08-13 13:22:10 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:22:08.337291+02:00: (<function load_platform.<locals>.discover_platform at 0x0407A978>,)
16-08-13 13:22:10 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:22:08.337291+02:00: (<function load_platform.<locals>.discover_platform at 0x0407A8E8>,)
16-08-13 13:22:10 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:22:08.337291+02:00: (<function load_platform.<locals>.discover_platform at 0x0407A9C0>,)
16-08-13 13:22:10 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:22:10.797468+02:00: (<function SensorTemplate.__init__.<locals>.template_sensor_state_listener at 0x052E68E8>, <Event state_changed[L]: old_state=None, new_state=<state sensor.licht_raamkozijn=; friendly_name=Lichtst. raamkozijn (legohuis), icon=mdi:lightbulb, unit_of_measurement=  @ 2016-08-13T13:22:10.766217+02:00>, entity_id=sensor.licht_raamkozijn>)

after changing everything, most of it is gone, but now i get the old part back:

16-08-13 13:44:51 homeassistant.components.sensor.template: UndefinedError: 'None' has no attribute 'attributes'
16-08-13 13:44:51 homeassistant.components.sensor.template: UndefinedError: 'None' has no attribute 'attributes'
16-08-13 13:44:51 homeassistant.components.sensor.template: UndefinedError: 'None' has no attribute 'attributes'
16-08-13 13:44:51 homeassistant.components.sensor.template: UndefinedError: 'None' has no attribute 'attributes'
16-08-13 13:44:51 homeassistant.components.sensor.template: UndefinedError: 'None' has no attribute 'attributes'
16-08-13 13:45:00 homeassistant.core: WorkerPool:All 23 threads are busy and 70 jobs pending
16-08-13 13:45:00 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:45:00.507226+02:00: (<function setup_scanner_platform.<locals>.device_tracker_scan at 0x0705FED0>, <Event time_changed[L]: now=2016-08-13T13:45:00.504226+02:00>)
16-08-13 13:45:00 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:45:00.508227+02:00: (<function EntityPlatform._update_entity_states at 0x04EB7DF8>, <Event time_changed[L]: now=2016-08-13T13:45:00.504226+02:00>)
16-08-13 13:45:00 homeassistant.core: WorkerPool:Current job from 2016-08-13T13:45:00.543250+02:00: (<function Group._state_changed_listener at 0x07BD11E0>, <Event state_changed[L]: new_state=<state sensor.cpu_use=50; unit_of_measurement=%, friendly_name=CPU Use, icon=mdi:memory @ 2016-08-13T13:45:00.508227+02:00>, old_state=<state sensor.cpu_use=0; unit_of_measurement=%, friendly_name=CPU Use, icon=mdi:memory @ 2016-08-13T13:44:49.341234+02:00>, entity_id=sensor.cpu_use>)

Hmm, strange. It is working here.

the error is also not helpfull.
it doesnt state which sensor is causing the error.

at least it is way!! better then before.

7 lines is not so annoying as 200 lines :wink:

Ok, but if you think that the code or the documentation can be improved, it would be great if you could help improving it.
For the documentation you can just press “Edit this page on GitHub” in the upper right corner to propose a change.

1 Like

i would love to help, but i still find it very hard to understand the programming.

some parts i understand, but there is to much from which i still raise my eyebrowes.

most of the documentation i find helpfull, but i miss a basic structure.

1 Like

you need to use " instead of ’ in your value template… with me it gave also problems, unless I used "

Same problem here.
I have 3 binary template sensors:

    binnen_warm:
      friendly_name: Binnen Warm
      # value_template: "{{ states('climate.thermostaat') > '25' }}"
      # value_template: "{{ states('climate.thermostaat') | float > 25 }}"
      value_template: "{{ states.climate.thermostaat.state | float > 25 }}"
    buiten_warm:
      friendly_name: Buiten Warm
      # value_template: "{{ states('sensor.pws_temp_c') > '25' }}"
      # value_template: "{{ states('sensor.pws_temp_c') | float > 25 }}"
      value_template: "{{ states.sensor.pws_temp_c.state | float > 25 }}"
    buiten_fris_genoeg:
      # value_template: "{{ states('sensor.pws_temp_c') < '24' }}"
      # value_template: "{{ states('sensor.pws_temp_c') | float < 24}}"
      value_template: "{{ states.sensor.pws_temp_c.state | float < 24 }}"

I’ve tried in different ways, always the same errors:

16-08-28 10:59:01 homeassistant.components.binary_sensor.template: UndefinedError: 'None' has no attribute 'state'
16-08-28 10:59:01 homeassistant.components.binary_sensor.template: UndefinedError: 'None' has no attribute 'state'
16-08-28 10:59:01 homeassistant.helpers.condition: Error duriong template condition: UndefinedError: 'None' has no attribute 'state'
16-08-28 10:59:01 homeassistant.components.binary_sensor.template: UndefinedError: 'None' has no attribute 'state'
16-08-28 10:59:01 homeassistant.helpers.condition: Error duriong template condition: UndefinedError: 'None' has no attribute 'state'
16-08-28 10:59:30 homeassistant.helpers.condition: Error duriong template condition: UndefinedError: 'None' has no attribute 'state'
16-08-28 10:59:30 homeassistant.components.binary_sensor.template: UndefinedError: 'None' has no attribute 'state'
16-08-28 10:59:30 homeassistant.helpers.condition: Error duriong template condition: UndefinedError: 'None' has no attribute 'state'
16-08-28 10:59:30 homeassistant.components.binary_sensor.template: UndefinedError: 'None' has no attribute 'state'
16-08-28 10:59:30 homeassistant.components.binary_sensor.template: UndefinedError: 'None' has no attribute 'state'
16-08-28 10:59:30 homeassistant.helpers.condition: Error duriong template condition: UndefinedError: 'None' has no attribute 'state'
16-08-28 10:59:30 homeassistant.helpers.condition: Error duriong template condition: UndefinedError: 'None' has no attribute 'state'
16-08-28 10:59:30 homeassistant.components.binary_sensor.template: UndefinedError: 'None' has no attribute 'state'

And they keep on coming…

@gieljnssns

For each sensor add the entity_id parameter:

      entity_id: 
       - pws_temp_c
       - input_slider.alarmminutes
2 Likes

Thanks a lot, you made my day!