I’m encountering an error when trying to use the twitter notification platform to send a direct message.
I have a dev account. and everything on that end seems to be working.
When looking at the source code I notice this hangup is on calling a method that allows for searching multiple users and returning an array of objects. Since we’re looking for a single user_id is it not returning an array?
Error executing service <ServiceCall notify.twitter_dm (c:87e2acc73a384b6ba6131c55f4be3376): message=Template("test")>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/core.py", line 1238, in _safe_execute
await self._execute_service(handler, service_call)
File "/usr/src/homeassistant/homeassistant/core.py", line 1253, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/components/notify/__init__.py", line 119, in async_notify_message
await notify_service.async_send_message(**kwargs)
File "/usr/src/homeassistant/homeassistant/components/notify/__init__.py", line 185, in async_send_message
await self.hass.async_add_job(partial(self.send_message, message, **kwargs))
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/twitter/notify.py", line 84, in send_message
self.upload_media_then_callback(callback, media)
File "/usr/src/homeassistant/homeassistant/components/twitter/notify.py", line 119, in upload_media_then_callback
return callback()
File "/usr/src/homeassistant/homeassistant/components/twitter/notify.py", line 90, in send_message_callback
user_id = user_resp.json()[0]["id"]
KeyError: 0
System Health
arch x86_64
dev false
docker true
hassio true
os_name Linux
python_version 3.7.6
timezone America/New_York
version 0.106.5
virtualenv false
The automation Call:
automation:
- alias: 'System nearly full'
trigger:
- platform: numeric_state
entity_id: sensor.magnum_bmk_soc
above: 98
condition:
- condition: template
value_template: "{{ states('sensor.magnum_inverter_aacin')|int > 0 }}"
action:
- service: notify.david
data:
message: "System nearing full. Disengage the generator."
the declaration:
#########
# David #
#########
- name: david
platform: group
services:
# - service: david_phone_service
# - service: html5
- service: twitter_dm
###########
# Twitter #
###########
- name: twitter_dm
platform: twitter
consumer_key: !secret twitter_api_key
consumer_secret: !secret twitter_api_secret
access_token: !secret twitter_access_token
access_token_secret: !secret twitter_access_secret
username: "ner0tic"