fredrikbaberg / ha-sensor-sl

Home Assistant sensor for sl.se departures
Apache License 2.0
5 stars 1 forks source link

sensor fails on start #22

Closed rutberg closed 5 years ago

rutberg commented 5 years ago

When following the instructions in the readme, including adding the custom component, I get the following results:

Wed Jan 16 2019 13:43:33 GMT+0100 (Central European Standard Time)

Update for sensor.sl_stureby fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/sensor/sl.py", line 158, in update
    if self._enabled_sensor is None or sensor_state.state is STATE_ON:
AttributeError: 'NoneType' object has no attribute 'state'

This is my configuration.yaml

# Sensors
sensor:
  # Weather prediction
  - platform: yr
  - platform: sl
    name: stureby
    ri4key: MyAPIKEY
    siteid: 9164
    lines: 17, 18, 19
    direction: 1
    sensor: binary_sensor.test
rutberg commented 5 years ago

Realized the fault being with the binary_sensor.test and no instruction to also add the sensor to configuration.yaml

theGurk commented 5 years ago

Realized the fault being with the binary_sensor.test and no instruction to also add the sensor to configuration.yaml

I can´t get it to work. How did you add it to the configuration.yaml file you mean?