home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.18k stars 30.21k forks source link

LaMetric Notify: TypeError: string indices must be integers #12983

Closed michelkaeser closed 6 years ago

michelkaeser commented 6 years ago

Home Assistant release (hass --version): 0.65.0.dev0

Python release (python3 --version): Python 3.6.4

Component/platform:

Description of problem: LaMetric notifications result in traceback.

Expected: No problem.

Problem-relevant configuration.yaml entries and steps to reproduce:

lametric:
  client_id: xxx
  client_secret: xxx

notify:
  name: lametric
  platform: lametric
  icon: a3579
  cycles: 2
  1. Run official Home assistant Docker container
  2. Add LaMetric component and notify
  3. Call the notify service

Traceback (if applicable):

2018-03-08 14:19:26 INFO (MainThread) [homeassistant.core] Bus:Handling <Event system_log_event[L]: timestamp=1520515166.694072, level=ERROR, message=Error executing service <ServiceCall notify.lametric: title=<homeassistant.helpers.template.Template object at 0x2abc7bd48588>, message=<homeassistant.helpers.template.Template object at 0x2abc7bd48668>>, exception=Traceback (most recent call last):
  File "/usr/src/app/homeassistant/core.py", line 1006, in _event_to_service_call
    await service_handler.func(service_call)
  File "/usr/src/app/homeassistant/components/notify/__init__.py", line 137, in async_notify_message
    yield from notify_service.async_send_message(**kwargs)
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 327, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 243, in result
    raise self._exception
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/notify/lametric.py", line 97, in send_message
    lmn.set_device(dev)
  File "/usr/local/lib/python3.6/site-packages/lmnotify/lmnotify.py", line 139, in set_device
    self.set_apps_list()
  File "/usr/local/lib/python3.6/site-packages/lmnotify/lmnotify.py", line 324, in set_apps_list
    result = self._exec(cmd, url)
  File "/usr/local/lib/python3.6/site-packages/lmnotify/lmnotify.py", line 80, in _exec
    url = url % self.dev["ipv4_internal"]
TypeError: string indices must be integers
, source=components/notify/lametric.py>

Additional info:

michelkaeser commented 6 years ago

I found out that the notification app was missing the read permission. Works flawlessly now!