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
73.75k stars 30.86k forks source link

Notify Pushsafer fails to send simple Text messages #12414

Closed VDRainer closed 6 years ago

VDRainer commented 6 years ago

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

Home Assistant release (hass --version): 0.63.2

Python release (python3 --version): 3.6.3

Component/platform: Notify / Pushsafer

Description of problem: Sending simple Textmessage with Title and message in an automation and also in Dev Tools/services fails. @appzer

{
  "title": "Test title",
  "message": "Test message"
}

Complex messages like stated in the docs do work.

Expected: Sending simple text messages

Traceback (if applicable):

2018-02-14 14:30:05 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall notify.pushsafer: title=<homeassistant.helpers.template.Template object at 0x7f1b5c86eeb8>, message=<homeassistant.helpers.template.Template object at 0x7f1b5c86e7b8>>
Traceback (most recent call last):
  File "/srv/ha/lib/python3.6/site-packages/homeassistant/core.py", line 1010, in _event_to_service_call
    yield from service_handler.func(service_call)
  File "/srv/ha/lib/python3.6/site-packages/homeassistant/components/notify/__init__.py", line 137, in async_notify_message
    yield from notify_service.async_send_message(**kwargs)
  File "/usr/lib/python3.6/asyncio/futures.py", line 332, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/ha/lib/python3.6/site-packages/homeassistant/components/notify/pushsafer.py", line 76, in send_message
    picture1 = data.get(ATTR_PICTURE1)
AttributeError: 'NoneType' object has no attribute 'get'

Additional info:

appzer commented 6 years ago

@VDRainer You have to declare the data parameter in your json, take a look at the documentation on https://home-assistant.io/components/notify.pushsafer/

VDRainer commented 6 years ago

Worked before 0.63. OK, now it works with:

      - service: notify.pushsafer       
        data_template: 
          title: "New Home Assistant Release"
          message: "Home Assistant {{ states.sensor.current_ha_version.state }} is now available."
          data: {}

But the docs should be updated.

To use notifications, please see the getting started with automation page.