Home Assistant Problem

Pushsafer make it easy and safe to get push-notifications in real time on your Android or Windows mobile device, iPhone, iPad and Desktop!

Mit Pushsafer kann man in Echtzeit, einfach und sicher, Push-Benachrichtigungen auf sein iPhone, iPad, Android oder Windows Gerät sowie auf den Desktop senden lassen!

======================
Google Play
App Store
Windows Store
Homepage
VDRainer

Home Assistant Problem

Postby VDRainer » 6. Mar 2017, 11:58

Hallo,

ich dachte ich poste das Problem mal hier, auf Deutsch, dann tu ich mir leichter als auf Englisch im HA Forum.
Ausserdem haben die im Moment wohl jede Menge mit der neuen 0.39 zu tun.
Nach Eintrag der Parameter laut Anleitung (https://home-assistant.io/components/notify.pushsafer/) will HA nicht mehr starten.

Code: Select all

17-03-06 12:40:45 ERROR (MainThread) [homeassistant.bootstrap] Invalid config for [notify.pushsafer]: required key not provided @ data['api_key']. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/notify.pushsafer/
Mir scheint HA erwartet einen "api_key" statt "private_key".

Nach Änderung von private_key zu api_key, startet HA zwar wieder, beim Senden einer Message kommt dann aber

Code: Select all

Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/tasks.py", line 242, in _step
    result = coro.throw(exc)
  File "/srv/homeassi/lib/python3.4/site-packages/homeassistant/core.py", line 1001, in _event_to_service_call
    yield from service_handler.func(service_call)
  File "/srv/homeassi/lib/python3.4/site-packages/homeassistant/components/notify/__init__.py", line 136, in async_notify_message
    yield from notify_service.async_send_message(**kwargs)
  File "/usr/lib/python3.4/asyncio/futures.py", line 358, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 297, in _wakeup
    future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassi/lib/python3.4/site-packages/homeassistant/components/notify/pushsafer.py", line 68, in send_message
    "0", "", "", "")
  File "/home/homeassi/.homeassistant/deps/pushsafer.py", line 106, in send_message
    return MessageRequest(payload)
  File "/home/homeassi/.homeassistant/deps/pushsafer.py", line 61, in __init__
    Request.__init__(self, "post", MESSAGE_URL, payload)
  File "/home/homeassi/.homeassistant/deps/pushsafer.py", line 48, in __init__
    raise InitError
pushsafer.InitError: No privatekey provided. Init the pushsafer module by calling the init function
im Log.

Danke fürś Lesen.
Ich würde Pushsaver gerne in HA verwenden.

Gruß

User avatar
admin
Site Admin
Posts: 943
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: Home Assistant Problem

Postby admin » 6. Mar 2017, 19:25

Hallo,

bitte in der yaml config Datei private_key durch privatekey ersetzten und nochmal testen!

Code: Select all

# Example configuration.yaml entry
notify:
  - name: NOTIFIER_NAME
    platform: pushsafer
    privatekey: ABCDEFGHJKLMNOPQRSTUVXYZ
Bitte um kurzes Feedback, ob es geklappt hat.

Grüße Kevin
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10

VDRainer

Re: Home Assistant Problem

Postby VDRainer » 6. Mar 2017, 21:24

Hallo Kevin,

leider bringt der "privatekey" auch nichts. Es bleibt die Meldung im Log:

Code: Select all

17-03-06 22:10:15 ERROR (MainThread) [homeassistant.bootstrap] Invalid config for [notify.pushsafer]: required key not provided @ data['api_key']. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/notify.pushsafer/
und der Service ist nicht vorhanden.
In der UI erscheint die Meldung:

Code: Select all

Invalid config
The following components and platforms could not be set up:

    notify.pushsafer

Please check your config 
Die Meldung im ersten Post, das HA nicht mehr startet, stimmt nicht. Ich hatte nur das Log im Auge.

Danke für die Hilfe!
Gruß
Rainer

User avatar
admin
Site Admin
Posts: 943
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: Home Assistant Problem

Postby admin » 6. Mar 2017, 22:26

Hallo Rainer,

es ist doch besser, du wendest dich an die HA Community.
Ich kenne mich mit HA zu wenig aus, um das Problem zu lösen.

Wenn du eine Lösung gefunden hast, würde ich mich freuen, wenn du diese mit mir teilst.

Kevin
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10

User avatar
admin
Site Admin
Posts: 943
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: Home Assistant Problem

Postby admin » 7. Mar 2017, 16:40

Hallo Rainer,

habe das Plugin überarbeitet und es bei home-assistant neu eingereicht.
https://github.com/home-assistant/home- ... /pull/6470

Jetzt ist nur die Frage, ob du bis zum nächsten Release warten musst, oder ob es reicht, wenn du Dateien im oben genannten Pullrequest austauschst.

Code: Select all

homeassistant/components/notify/pushsafer.py
equirements_all.txt
Working code:

Code: Select all

"""
Pushsafer platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.pushsafer/
"""
import logging

import requests
import voluptuous as vol

from homeassistant.components.notify import (
    ATTR_TITLE, ATTR_TITLE_DEFAULT, PLATFORM_SCHEMA, BaseNotificationService)
import homeassistant.helpers.config_validation as cv

_LOGGER = logging.getLogger(__name__)
_RESOURCE = 'https://www.pushsafer.com/api'

CONF_DEVICE_KEY = 'private_key'

DEFAULT_TIMEOUT = 10

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_DEVICE_KEY): cv.string,
})


def get_service(hass, config, discovery_info=None):
    """Get the Pushsafer.com notification service."""
    return PushsaferNotificationService(config.get(CONF_DEVICE_KEY))


class PushsaferNotificationService(BaseNotificationService):
    """Implementation of the notification service for Pushsafer.com."""

    def __init__(self, private_key):
        """Initialize the service."""
        self._private_key = private_key

    def send_message(self, message='', **kwargs):
        """Send a message to a user."""
        title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)
        payload = {'k': self._private_key, 't': title, 'm': message}
        response = requests.get(_RESOURCE, params=payload,
                                timeout=DEFAULT_TIMEOUT)
        if response.status_code != 200:
            _LOGGER.error("Not possible to send notification")
Grüße Kevin
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10


Who is online

Users browsing this forum: No registered users and 30 guests