alexa-fhem: amazon alexa smart home skill für fhem

Begonnen von justme1968, 05 November 2016, 23:21:32

Vorheriges Thema - Nächstes Thema

amenomade

@blane: Was sagt
journalctl -u alexa --since "2017-08-31 13:15" --until "2017-08-31 13:30"?

(evtl. mit sudo davorne, ich weiss nicht)
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

blane

Zitat von: amenomade am 31 August 2017, 19:59:29
@blane: Was sagt
journalctl -u alexa --since "2017-08-31 13:15" --until "2017-08-31 13:30"?

(evtl. mit sudo davorne, ich weiss nicht)

Aug 31 13:15:40 nuc systemd[1]: alexa.service: Service hold-off time over, scheduling restart.
Aug 31 13:15:40 nuc systemd[1]: Stopped Node.js Alexa Server.
Aug 31 13:15:40 nuc systemd[1]: Started Node.js Alexa Server.
Aug 31 13:15:41 nuc alexa[5103]: [2017-8-31 13:15:41] using ~/.alexa/config.json
Aug 31 13:15:41 nuc alexa[5103]: [2017-8-31 13:15:41] Couldn't find a config.json file at '~/.alexa/config.json'. Look at config-sample.json for an exa
Aug 31 13:15:41 nuc systemd[1]: alexa.service: Main process exited, code=exited, status=1/FAILURE
Aug 31 13:15:41 nuc systemd[1]: alexa.service: Unit entered failed state.
Aug 31 13:15:41 nuc systemd[1]: alexa.service: Failed with result 'exit-code'.


Dies einige Male.

amenomade

Dann hast Du die Erklärung im klar Text:
Aug 31 13:15:41 nuc alexa[5103]: [2017-8-31 13:15:41] Couldn't find a config.json file at '~/.alexa/config.json'. Look at config-sample.json for an exa
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Byllyy

Hallo zusammen
Habe Alexa-Fhem nach der Wiki Anleitung installiert und mit ./bin/alexa startet er einwandfrei und läuft, dafür schon einmal Danke an den Entwickler.
Leider habe ich auch das Problem, dass der automatische Start nicht klappt. Die Lösungsvorschläge hier im Forum haben bei mir leider nicht geholfen.
Hier meine Daten:
Bei Start mit ./bin/alexa kommt :
pi@raspberrypi:/opt/fhem/alexa-fhem $ ./bin/alexa
[9/1/2017, 12:07:20 PM] using /home/pi/.alexa/config.json
[9/1/2017, 12:07:20 PM] ---
[9/1/2017, 12:07:20 PM] this is alexa-fhem 0.3.4
[9/1/2017, 12:07:20 PM] Fetching FHEM devices...
[9/1/2017, 12:07:20 PM] [FHEM] starting longpoll: http://127.0.0.1:8083/fhem?XHR=1&inform=type=status;addglobal=1;filter=.*;since=null;fmt=JSON&timestamp=1504260440570
[9/1/2017, 12:07:20 PM] Server listening on: https://:::3000
[9/1/2017, 12:07:20 PM] [FHEM] Checking devices and attributes...
[9/1/2017, 12:07:20 PM] [FHEM]   executing: http://127.0.0.1:8083/fhem?cmd=%7BAttrVal(%22global%22,%22userattr%22,%22%22)%7D&XHR=1
[9/1/2017, 12:07:20 PM] [FHEM]   executing: http://127.0.0.1:8083/fhem?cmd=jsonlist2%20TYPE=alexa&XHR=1
[9/1/2017, 12:07:20 PM] [FHEM] Fetching FHEM devices...
[9/1/2017, 12:07:20 PM] [FHEM] fetching: http://127.0.0.1:8083/fhem?cmd=jsonlist2%20room=Alexa&XHR=1
   und Alles ist OK.

beim automatischen Start kommt:
pi@raspberrypi:/opt/fhem/alexa-fhem $ sudo systemctl status alexa
● alexa.service - Node.js Alexa Server
   Loaded: loaded (/etc/systemd/system/alexa.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since Fri 2017-09-01 12:09:36 CEST; 1s ago
  Process: 1242 ExecStart=/opt/fhem/alexa-fhem/bin/alexa $ALEXA_OPTS (code=exited, status=217/USER)
Main PID: 1242 (code=exited, status=217/USER)


meine Datei unter /etc/default
# Defaults / Konfigurations Optionen für alexa-fhem
# Wo findet alexa-fhem die config.json Datei?
ALEXA_OPTS=-U /home/pi/.alexa


meine Datei unter /etc/systemd/system
[Unit]
Description=Node.js Alexa Server
After=syslog.target network-online.target

[Service]
Type=simple
User=fhem #oder ein anderer Benutzer wie fhem
EnvironmentFile=/etc/default/alexa
# oder wo auch immer eure alexa-fhem liegt
ExecStart=/opt/fhem/alexa-fhem/bin/alexa $ALEXA_OPTS
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target


Log:
pi@raspberrypi:/opt/fhem/alexa-fhem $ sudo journalctl -u alexa
-- Logs begin at Fri 2017-09-01 11:55:17 CEST, end at Fri 2017-09-01 12:15:03 CEST. --
Sep 01 11:55:29 raspberrypi systemd[1]: Starting Node.js Alexa Server...
Sep 01 11:55:29 raspberrypi systemd[1]: Started Node.js Alexa Server.
Sep 01 11:55:29 raspberrypi systemd[1]: alexa.service: main process exited, code=exited, status=
Sep 01 11:55:29 raspberrypi systemd[1]: Unit alexa.service entered failed state.
Sep 01 11:55:45 raspberrypi systemd[1]: alexa.service holdoff time over, scheduling restart.
Sep 01 11:55:45 raspberrypi systemd[1]: Stopping Node.js Alexa Server...
Sep 01 11:55:45 raspberrypi systemd[1]: Starting Node.js Alexa Server...
Sep 01 11:55:45 raspberrypi systemd[1]: Started Node.js Alexa Server.
Sep 01 11:55:45 raspberrypi systemd[1]: alexa.service: main process exited, code=exited, status=
Sep 01 11:55:45 raspberrypi systemd[1]: Unit alexa.service entered failed state.
Sep 01 11:55:56 raspberrypi systemd[1]: alexa.service holdoff time over, scheduling restart.
Sep 01 11:55:56 raspberrypi systemd[1]: Stopping Node.js Alexa Server...
Sep 01 11:55:56 raspberrypi systemd[1]: Starting Node.js Alexa Server...
Sep 01 11:55:56 raspberrypi systemd[1]: Started Node.js Alexa Server.
Sep 01 11:55:56 raspberrypi systemd[1]: alexa.service: main process exited, code=exited, status=
Sep 01 11:55:56 raspberrypi systemd[1]: Unit alexa.service entered failed state.
Sep 01 11:56:06 raspberrypi systemd[1]: alexa.service holdoff time over, scheduling restart.
Sep 01 11:56:06 raspberrypi systemd[1]: Stopping Node.js Alexa Server...
Sep 01 11:56:06 raspberrypi systemd[1]: Starting Node.js Alexa Server...
Sep 01 11:56:06 raspberrypi systemd[1]: Started Node.js Alexa Server.
Sep 01 11:56:06 raspberrypi systemd[1]: alexa.service: main process exited, code=exited, status=
Sep 01 11:56:06 raspberrypi systemd[1]: Unit alexa.service entered failed state.
lines 1-23



Es wäre nett wenn jemand helfen könnte.
Danke,
Byllyy


Amenophis86

Hier ist dein Fehler:

ExecStart=/opt/fhem/alexa-fhem/bin/alexa $ALEXA_OPTS (code=exited, status=217/USER)
Aktuell dabei unser neues Haus mit KNX am einrichten. Im nächsten Schritt dann KNX mit FHEM verbinden. Allein zwei Dinge sind dabei selten: Zeit und Geld...

Byllyy

Danke für die super schnelle Antwort.
Genau nach diesem Fehler habe ich im Forum gesucht, doch leider half keine der Lösungsvorschläge.
Ich denke auch es liegt am User oder an den Rechten.

Kannst Du mir evtl. weiter helfen?

Danke

Amenophis86

Trag mal bei /etc/systemd/system unter user nicht fhem, sondern pi ein und starte versuch es dann nochmal.
Aktuell dabei unser neues Haus mit KNX am einrichten. Im nächsten Schritt dann KNX mit FHEM verbinden. Allein zwei Dinge sind dabei selten: Zeit und Geld...

Byllyy

Ok, habe den User geändert auf pi:
[Unit]
Description=Node.js Alexa Server
After=syslog.target network-online.target

[Service]
Type=simple
User=pi #oder ein anderer Benutzer wie fhem
EnvironmentFile=/etc/default/alexa
# oder wo auch immer eure alexa-fhem liegt
ExecStart=/opt/fhem/alexa-fhem/bin/alexa $ALEXA_OPTS
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target


Meldung bleibt leider :
pi@raspberrypi:~ $ sudo systemctl status alexa
● alexa.service - Node.js Alexa Server
   Loaded: loaded (/etc/systemd/system/alexa.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since Fri 2017-09-01 12                                                                                                                                                             :45:32 CEST; 344ms ago
  Process: 973 ExecStart=/opt/fhem/alexa-fhem/bin/alexa $ALEXA_OPTS (code=exited                                                                                                                                                             , status=217/USER)
Main PID: 973 (code=exited, status=217/USER)

Sep 01 12:45:32 raspberrypi systemd[1]: alexa.service: main process exited, ...R
Sep 01 12:45:32 raspberrypi systemd[1]: Unit alexa.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.

amenomade

Zur Sicherheit, lass mal die $ALEXA_OPTS Geschichte fallen, und schreib einfach

ExecStart=/opt/fhem/alexa-fhem/bin/alexa -U /home/pi/.alexa

Notiz @justme1968 (oder denjenigen, der den Wiki Artikel pflegt): das mit /etc/default
- hat viel weniger Sinn seit systemd Einführung anstatt init.d, insb. wenn "nur" eine Variable
- bringt nur ein zusätzliches Komplexitätsnivo für den "normalen" Benutzer
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Byllyy

Habe ich jetzt geändert, Fehler bleibt :

pi@raspberrypi:~ $ sudo systemctl status alexa
● alexa.service - Node.js Alexa Server
   Loaded: loaded (/etc/systemd/system/alexa.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since Fri 2017-09-01 13                 :03:21 CEST; 433ms ago
  Process: 967 ExecStart=/opt/fhem/alexa-fhem/bin/alexa -U /home/pi/.alexa (code                 =exited, status=217/USER)
Main PID: 967 (code=exited, status=217/USER)

Sep 01 13:03:21 raspberrypi systemd[1]: Unit alexa.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.
pi@raspberrypi:~ $


Danke für deine schnelle Hilfe,
Byllyy

justme1968

zum starten: ich kann nur empfehlen sich node forever anzuschauen und damit ein start script zu bauen. irgendwo weiter oben habe ich schon mal was dazu geschrieben.

die im wiki und hier im forum beschriebene start methode und die integration in fhem verwende ich nicht. dazu kann ich leider nichts weiter sagen.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

Amenophis86

leg nochmal das WorkingDirectory ein, natürlich dem entsprechend, wo es liegt.
WorkingDirectory=/opt/fhem/alexa-fhem/
Aktuell dabei unser neues Haus mit KNX am einrichten. Im nächsten Schritt dann KNX mit FHEM verbinden. Allein zwei Dinge sind dabei selten: Zeit und Geld...

Byllyy

Habe ich jetzt mit eingetragen.

[Unit]
Description=Node.js Alexa Server
After=syslog.target network-online.target

[Service]
Type=simple
User=pi #oder ein anderer Benutzer wie fhem
EnvironmentFile=/etc/default/alexa
# oder wo auch immer eure alexa-fhem liegt
WorkingDirectory=/opt/fhem/alexa-fhem/
ExecStart=/opt/fhem/alexa-fhem/bin/alexa -U /home/pi/.alexa
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target


Leider bleibt der Fehler

pi@raspberrypi:~ $ sudo systemctl status alexa
● alexa.service - Node.js Alexa Server
   Loaded: loaded (/etc/systemd/system/alexa.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since Fri 2017-09-01 13:23:37 CEST; 2s ago
  Process: 1182 ExecStart=/opt/fhem/alexa-fhem/bin/alexa -U /home/pi/.alexa (code=exited, status=217/USER)
Main PID: 1182 (code=exited, status=217/USER)

Sep 01 13:23:37 raspberrypi systemd[1]: Unit alexa.service entered failed state.


hoffe das ich nicht doch ein anderen evtl. ganz dummen Fehler mit drin habe.

amenomade

Ändere noch:
ExecStart=/opt/fhem/alexa-fhem/bin/alexa --debug -U /home/pi/.alexa

Und zeig bitte journalctl
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Byllyy

Ok, sudo systemctl daemon-reload habe ich natürlich auch immer gemacht.


pi@raspberrypi:~ $ sudo journalctl -u alexa
-- Logs begin at Fri 2017-09-01 13:30:27 CEST, end at Fri 2017-09-01 13:32:58 CEST. --
Sep 01 13:30:39 raspberrypi systemd[1]: Starting Node.js Alexa Server...
Sep 01 13:30:39 raspberrypi systemd[1]: Started Node.js Alexa Server.
Sep 01 13:30:39 raspberrypi systemd[1]: alexa.service: main process exited, code=exited, status=217/USER
Sep 01 13:30:39 raspberrypi systemd[1]: Unit alexa.service entered failed state.
Sep 01 13:30:55 raspberrypi systemd[1]: alexa.service holdoff time over, scheduling restart.
Sep 01 13:30:55 raspberrypi systemd[1]: Stopping Node.js Alexa Server...
Sep 01 13:30:55 raspberrypi systemd[1]: Starting Node.js Alexa Server...
Sep 01 13:30:55 raspberrypi systemd[1]: Started Node.js Alexa Server.
Sep 01 13:30:55 raspberrypi systemd[1]: alexa.service: main process exited, code=exited, status=217/USER
Sep 01 13:30:55 raspberrypi systemd[1]: Unit alexa.service entered failed state.
Sep 01 13:31:05 raspberrypi systemd[1]: alexa.service holdoff time over, scheduling restart.
Sep 01 13:31:05 raspberrypi systemd[1]: Stopping Node.js Alexa Server...
Sep 01 13:31:05 raspberrypi systemd[1]: Starting Node.js Alexa Server...
Sep 01 13:31:05 raspberrypi systemd[1]: Started Node.js Alexa Server.
Sep 01 13:31:05 raspberrypi systemd[1]: alexa.service: main process exited, code=exited, status=217/USER
Sep 01 13:31:05 raspberrypi systemd[1]: Unit alexa.service entered failed state.
Sep 01 13:31:16 raspberrypi systemd[1]: alexa.service holdoff time over, scheduling restart.
Sep 01 13:31:16 raspberrypi systemd[1]: Stopping Node.js Alexa Server...
Sep 01 13:31:16 raspberrypi systemd[1]: Starting Node.js Alexa Server...
Sep 01 13:31:16 raspberrypi systemd[1]: Started Node.js Alexa Server.
Sep 01 13:31:16 raspberrypi systemd[1]: alexa.service: main process exited, code=exited, status=217/USER
Sep 01 13:31:16 raspberrypi systemd[1]: Unit alexa.service entered failed state.
Sep 01 13:31:26 raspberrypi systemd[1]: alexa.service holdoff time over, scheduling restart.
Sep 01 13:31:26 raspberrypi systemd[1]: Stopping Node.js Alexa Server...
Sep 01 13:31:26 raspberrypi systemd[1]: Starting Node.js Alexa Server...
Sep 01 13:31:26 raspberrypi systemd[1]: Started Node.js Alexa Server.
Sep 01 13:31:26 raspberrypi systemd[1]: alexa.service: main process exited, code=exited, status=217/USER
Sep 01 13:31:26 raspberrypi systemd[1]: Unit alexa.service entered failed state.
Sep 01 13:31:36 raspberrypi systemd[1]: alexa.service holdoff time over, scheduling restart.
Sep 01 13:31:36 raspberrypi systemd[1]: Stopping Node.js Alexa Server...
Sep 01 13:31:36 raspberrypi systemd[1]: Starting Node.js Alexa Server...
Sep 01 13:31:36 raspberrypi systemd[1]: Started Node.js Alexa Server.
Sep 01 13:31:36 raspberrypi systemd[1]: alexa.service: main process exited, code=exited, status=217/USER
Sep 01 13:31:36 raspberrypi systemd[1]: Unit alexa.service entered failed state.
Sep 01 13:31:46 raspberrypi systemd[1]: alexa.service holdoff time over, scheduling restart.
Sep 01 13:31:46 raspberrypi systemd[1]: Stopping Node.js Alexa Server...
Sep 01 13:31:46 raspberrypi systemd[1]: Starting Node.js Alexa Server...
Sep 01 13:31:46 raspberrypi systemd[1]: Started Node.js Alexa Server.
Sep 01 13:31:46 raspberrypi systemd[1]: alexa.service: main process exited, code=exited, status=217/USER
Sep 01 13:31:46 raspberrypi systemd[1]: Unit alexa.service entered failed state.
Sep 01 13:31:57 raspberrypi systemd[1]: alexa.service holdoff time over, scheduling restart.
Sep 01 13:31:57 raspberrypi systemd[1]: Stopping Node.js Alexa Server...
Sep 01 13:31:57 raspberrypi systemd[1]: Starting Node.js Alexa Server...
Sep 01 13:31:57 raspberrypi systemd[1]: Started Node.js Alexa Server.
Sep 01 13:31:57 raspberrypi systemd[1]: alexa.service: main process exited, code=exited, status=217/USER
Sep 01 13:31:57 raspberrypi systemd[1]: Unit alexa.service entered failed state.
Sep 01 13:32:07 raspberrypi systemd[1]: alexa.service holdoff time over, scheduling restart.
Sep 01 13:32:07 raspberrypi systemd[1]: Stopping Node.js Alexa Server...
Sep 01 13:32:07 raspberrypi systemd[1]: Starting Node.js Alexa Server...
Sep 01 13:32:07 raspberrypi systemd[1]: Started Node.js Alexa Server.
Sep 01 13:32:07 raspberrypi systemd[1]: alexa.service: main process exited, code=exited, status=217/USER
Sep 01 13:32:07 raspberrypi systemd[1]: Unit alexa.service entered failed state.
Sep 01 13:32:17 raspberrypi systemd[1]: alexa.service holdoff time over, scheduling restart.
Sep 01 13:32:17 raspberrypi systemd[1]: Stopping Node.js Alexa Server...
Sep 01 13:32:17 raspberrypi systemd[1]: Starting Node.js Alexa Server...
Sep 01 13:32:17 raspberrypi systemd[1]: Started Node.js Alexa Server.
Sep 01 13:32:17 raspberrypi systemd[1]: alexa.service: main process exited, code=exited, status=217/USER
Sep 01 13:32:17 raspberrypi systemd[1]: Unit alexa.service entered failed state.
Sep 01 13:32:27 raspberrypi systemd[1]: alexa.service holdoff time over, scheduling restart.
Sep 01 13:32:27 raspberrypi systemd[1]: Stopping Node.js Alexa Server...
Sep 01 13:32:27 raspberrypi systemd[1]: Starting Node.js Alexa Server...
lin