custom-components / authenticated

A platform which allows you to get information about sucessfull logins to Home Assistant.
MIT License
82 stars 28 forks source link

Update for sensor.last_successful_authentication fails #18

Closed VirtualL closed 6 years ago

VirtualL commented 6 years ago

Version of the cusom_component: 0.0.9

Describe the bug After successful authentication , the sensor try to update , with so success. my is config like this : (default) logger:

log

Update for sensor.last_successful_authentication fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 199, in async_update_ha_state
    yield from self.async_device_update()
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 322, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/sensor/authenticated.py", line 174, in update
    self.new_ip(ip_address, access_time, hostname)
  File "/home/homeassistant/.homeassistant/custom_components/sensor/authenticated.py", line 104, in new_ip
    self.write_file(ip_address, access_time, hostname, geo_country, geo_region, geo_city)
  File "/home/homeassistant/.homeassistant/custom_components/sensor/authenticated.py", line 144, in write_file
    city=city
TypeError: 'NoneType' object does not support item assignment
ludeeus commented 6 years ago

It looks like it cannot write to the yaml file. does .ip_authenticated.yaml exist, and does it have any content? If the file is blank it will give an error like that

VirtualL commented 6 years ago

after i removed the .ip_authenticated.yaml the problem solved. Thanks!