Alexa FHEM - Probleme bei der Installation

Begonnen von kblc, 02 Juli 2017, 20:13:36

Vorheriges Thema - Nächstes Thema

kblc

Hallo an alle,
ich möchte gerne über mein Alexa-Teil meine Lichter von FHEM steuern. FHEM läuft bei mir auf einen komplett aktuellen Raspberry Pi 3. FHEM läuft bei mir gut.
Jetzt zu meinen Problem, an dem ich seit Mitte Mai jede freie Minute dran sitze:

Vorab: Es geht um die Fehlermeldung im Thema unten rot, fett markiert.

Ich halte mich an die Anleitung https://wiki.fhem.de/wiki/Alexa-Fhem. Leider habe ich in diesem Schritt ein Problem. Meine Internetrecherche ergab auch nichts:

2.2.5   Alexa-Fhem als Service (systemd) installieren

Und zwar habe ich alles installiert und eingerichtet.

Meine config.json befindet sich (wenn ich mich über das Terminal von meinem Mac aus anmelde) hier.

Last login: Sun Jul  2 19:48:49 on ttys003
Macbook-13:~ KaiLudwig$ ssh pi@192.168.78.136
pi@192.168.78.136's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Jul  2 17:48:56 2017 from 192.168.78.181
pi@fhem:~ $ cd alexa-fhem
pi@fhem:~/alexa-fhem $ cd bin
pi@fhem:~/alexa-fhem/bin $ ls
alexa
pi@fhem:~/alexa-fhem/bin $ cd
pi@fhem:~ $ cd alexa-fhem
pi@fhem:~/alexa-fhem $ ls
bin          config-sample.json  lambda.js     package.json  TODO
cert.pem     createKey.sh        lib           README.md
config.json  key.pem             node_modules  server.js
pi@fhem:~/alexa-fhem $ sudo nano config.json
pi@fhem:~/alexa-fhem $


In der Beschreibung steht:

ZitatDatei "alexa" unter /etc/default anlegen

# Defaults / Konfigurations Optionen für alexa-fhem
# Wo findet alexa-fhem die config.json Datei?
ALEXA_OPTS=-U /opt/fhem/.alexa

Die Datei schaut bei mir so aus:

  GNU nano 2.2.6               Datei: alexa                                     

# Defaults / Konfigurations Optionen für alexa-fhem
# Wo findet alexa-fhem die config.json Datei?
ALEXA_OPTS=-U /opt/fhem/alexa-fhem/alexa

















^G Hilfe     ^O Speichern ^R Datei öffn^Y Seite zurü^K Ausschneid^C Cursor
^X Beenden   ^J Ausrichten^W Wo ist    ^V Seite vor ^U Ausschn. r^T Rechtschr.



In der Beschreibung steht:
Zitatatei "alexa.service" unter /etc/systemd/system anlegen:

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

[Service]
Type=simple
User=alexa #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

Das habe ich gemacht und das schaut bei mir dann so aus:

  GNU nano 2.2.6            Datei: alexa.service                     Verändert 

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

[Service]
Type=simple
User=alexa #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




^G Hilfe     ^O Speichern ^R Datei öffn^Y Seite zurü^K Ausschneid^C Cursor
^X Beenden   ^J Ausrichten^W Wo ist    ^V Seite vor ^U Ausschn. r^T Rechtschr.


Wenn ich dann mit der Anleitung weiter mache, erhalte ich eine Fehlermeldung.

Ich gebe wie in der Anleitung
Zitatsudo systemctl daemon-reload
sudo systemctl enable alexa
sudo systemctl start alexa
ein und dann noch
Zitatsudo systemctl status alexa
.


--------Hier die Fehlermeldung, wie oben angekündigt.---------

pi@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 So 2017-07-02 18:03:21 UTC; 6s ago
  Process: 26871 ExecStart=/opt/fhem/alexa-fhem/bin/alexa (code=exited, status=217/USER)
Main PID: 26871 (code=exited, status=217/USER)

Jul 02 18:03:21 fhem systemd[1]: alexa.service: main process exited, code=e...ER
Jul 02 18:03:21 fhem systemd[1]: Unit alexa.service entered failed state.

Warning: Unit file changed on disk, 'systemctl daemon-reload' recommended.
Hint: Some lines were ellipsized, use -l to show in full.
pi@fhem:~ $





Was mache ich falsch?
Ich habe das ganze schon drei mal komplett durchgemacht, immer wieder kontrolliert und gelöscht, neu aufgesetzt und ...
ich würde mich echt freuen, wenn ich einen Tipp oder Hilfe bekommen könnte.

Vielen vielen Dank.

Ich bin mir sicher, dass es bestimmt nicht bei der einen Frage von mir bleiben wird. Allerdings habe ich es echt versucht einmal ohne Hilfe zu schaffen. Leider ohne Erfolg.

Kai aus Oberfranken
SPS, Arduino, Controllino, Sensortechnik, Elektronik

amenomade

Mach mal bitte
pi@fhem:~/alexa-fhem $ ls -la ~/alexa-fhem

Ascheinend hast Du alexa-fhem im Home Verzeichnis vom User pi. Da musst Du auf den Berechtigungen aufpassen.

Dann... was passiert, wenn Du alexa-fhem manuell startest?
cd ~/alexa-fhem
./bin/alexa --debug
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

kblc

#2
Hallo,
danke für die schnelle Antwort.
Ich habe alles gemacht. Folgendes kam dabei heraus. Ich habe gleich mal alles kopiert.
Zitat
pi@fhem:~ $ cd alexa-fhem
pi@fhem:~/alexa-fhem $ ls -la ~/alexa-fhem
insgesamt 96
drwxr-xr-x  5 pi pi  4096 Jun 27 19:51 .
drwxr-xr-x 27 pi pi  4096 Jul  1 18:17 ..
drwxr-xr-x  2 pi pi  4096 Mai 22 15:54 bin
-rw-r--r--  1 pi pi  1363 Mai 22 15:59 cert.pem
-rw-r--r--  1 pi pi   526 Jun 28 19:54 config.json
-rw-r--r--  1 pi pi   520 Nov 25  2016 config-sample.json
-rwxr-xr-x  1 pi pi   150 Nov  5  2016 createKey.sh
-rw-r--r--  1 pi pi  1675 Mai 22 16:00 key.pem
-rw-r--r--  1 pi pi  1183 Dez 23  2016 lambda.js
drwxr-xr-x  2 pi pi  4096 Mai 22 15:54 lib
drwxr-xr-x  7 pi pi  4096 Mai 22 15:56 node_modules
-rw-r--r--  1 pi pi    33 Nov  5  2016 .npmignore
-rw-r--r--  1 pi pi   373 Jan  3 10:56 package.json
-rw-r--r--  1 pi pi  2830 Nov  8  2016 README.md
-rw-r--r--  1 pi pi 35939 Nov 22  2016 server.js
-rw-r--r--  1 pi pi  1252 Dez 28  2016 TODO
pi@fhem:~/alexa-fhem $ cd ~/alexa-fhem
pi@fhem:~/alexa-fhem $ ./bin/alexa --debug
[2017-07-03 17:24:42] using /home/pi/.alexa/config.json
[2017-07-03 17:24:42] ---
[2017-07-03 17:24:42] this alexa-fhem 0.1.9
[2017-07-03 17:24:42] Fetching FHEM devices...
[2017-07-03 17:24:42] [FHEM] Checking devices and attributes...
[2017-07-03 17:24:42] [FHEM]   executing: http://192.168.78.136:8083/fhem?cmd=%7BAttrVal(%22global%22,%22userattr%22,%22%22)%7D&XHR=1
[2017-07-03 17:24:42] [FHEM]   executing: http://192.168.78.136:8083/fhem?cmd=jsonlist2%20TYPE=alexa&XHR=1
[2017-07-03 17:24:42] [FHEM] starting longpoll: http://192.168.78.136:8083/fhem.pl?XHR=1&inform=type=status;addglobal=1;filter=.*;since=null;fmt=JSON&timestamp=1499102682437
[2017-07-03 17:24:42] [FHEM] Fetching FHEM devices...
[2017-07-03 17:24:42] [FHEM] fetching: http://192.168.78.136:8083/fhem?cmd=jsonlist2%20room=alexa&XHR=1
[2017-07-03 17:24:42] Server listening on: https://:::3000
[2017-07-03 17:24:42] [FHEM] alexa device is MyAlexa
[2017-07-03 17:24:42] [FHEM] mappings for MyAlexa: {}
[2017-07-03 17:24:42] [FHEM] MyAlexa is switch
[2017-07-03 17:24:42] [FHEM] MyAlexa has
[2017-07-03 17:24:42] [FHEM] homebridgeMapping: #Characteristic=<name>=<value>,...
On=verb=schalte,valueOn=an;ein,valueOff=aus,valueToggle=um

Brightness=verb=stelle,property=helligkeit,valuePrefix=auf,values=AMAZON.NUMBER,valueSuffix=prozent

Hue=verb=stelle,valuePrefix=auf,values=rot:0;grün:128;blau:200
Hue=verb=färbe,values=rot:0;grün:120;blau:220

Saturation=verb=stelle,property=sättigung,valuePrefix=auf,values=AMAZON.NUMBER
Saturation=verb=sättige,values=AMAZON.NUMBER

TargetPosition=verb=mach,articles=den;die,values=auf:100;zu:0
TargetPosition=verb=stelle,valuePrefix=auf,values=AMAZON.NUMBER,valueSuffix=prozent

TargetTemperature=verb=stelle,valuePrefix=auf,values=AMAZON.NUMBER,valueSuffix=grad

Volume:verb=stelle,valuePrefix=auf,values=AMAZON.NUMBER,valueSuffix=prozent

#Weckzeit=verb=stelle,valuePrefix=auf;für,values=AMAZON.TIME,valueSuffix=uhr
[2017-07-03 17:24:42] [FHEM] value2homekit: { 'AMAZON.NUMBER': 'AMAZON.NUMBER' }
[2017-07-03 17:24:42] [FHEM] value2homekit: { rot: '0', 'grün': '128', blau: '200' }
[2017-07-03 17:24:42] [FHEM] value2homekit: { rot: '0', 'grün': '120', blau: '220' }
[2017-07-03 17:24:42] [FHEM] value2homekit: { 'AMAZON.NUMBER': 'AMAZON.NUMBER' }
[2017-07-03 17:24:42] [FHEM] value2homekit: { 'AMAZON.NUMBER': 'AMAZON.NUMBER' }
[2017-07-03 17:24:42] [FHEM] value2homekit: { auf: '100', zu: '0' }
[2017-07-03 17:24:42] [FHEM] value2homekit: { 'AMAZON.NUMBER': 'AMAZON.NUMBER' }
[2017-07-03 17:24:42] [FHEM] value2homekit: { 'AMAZON.NUMBER': 'AMAZON.NUMBER' }
[2017-07-03 17:24:42] [FHEM] value2homekit: { 'AMAZON.NUMBER': 'AMAZON.NUMBER' }
[2017-07-03 17:24:42] [FHEM]   executing: http://192.168.78.136:8083/fhem?cmd=%7B$defs%7BMyAlexa%7D-%3E%7B%22active%22%7D%20=%201%7D&XHR=1
[2017-07-03 17:24:42] [FHEM]   executing: http://192.168.78.136:8083/fhem?cmd=%7B$defs%7BMyAlexa%7D-%3E%7B%22alexa-fhem%20version%22%7D%20=%20%220.1.9%22%7D&XHR=1
[2017-07-03 17:24:42] [FHEM]   executing: http://192.168.78.136:8083/fhem?cmd=%7B$defs%7BMyAlexa%7D-%3E%7B%22active%22%7D%20=%200%7D&XHR=1
[2017-07-03 17:24:42] { stelle: 'gestellt',
  schalte: 'geschaltet',
  'färbe': 'gefärbt',
  mach: 'gemacht' }
[2017-07-03 17:24:42] [ OnIntent: [ 'schalte' ],
  prozentIntent: [ 'stelle' ],
  HueIntent: [ 'stelle' ],
  HueIntentB: [ 'färbe' ],
  SaturationIntent: [ 'stelle' ],
  SaturationIntentB: [ 'sättige' ],
  TargetPositionIntent: [ 'mach' ],
  gradIntent: [ 'stelle' ] ]
[2017-07-03 17:24:42] { OnIntent: [ 'On' ],
  prozentIntent: [ 'Brightness', 'TargetPosition', 'Volume' ],
  HueIntent: [ 'Hue' ],
  HueIntentB: [ 'Hue' ],
  SaturationIntent: [ 'Saturation' ],
  SaturationIntentB: [ 'Saturation' ],
  TargetPositionIntent: [ 'TargetPosition' ],
  gradIntent: [ 'TargetTemperature' ] }
[2017-07-03 17:24:42] { OnIntent: undefined,
  prozentIntent: 'auf',
  HueIntent: 'auf',
  HueIntentB: undefined,
  SaturationIntent: 'auf',
  SaturationIntentB: undefined,
  TargetPositionIntent: undefined,
  gradIntent: 'auf' }
[2017-07-03 17:24:42] { OnIntent: undefined,
  prozentIntent: 'prozent',
  HueIntent: undefined,
  HueIntentB: undefined,
  SaturationIntent: undefined,
  SaturationIntentB: undefined,
  TargetPositionIntent: undefined,
  gradIntent: 'grad' }
[2017-07-03 17:24:42] { light: [ 'licht', 'lampen' ],
  blind:
   [ 'rolladen',
     'rolläden',
     'jalousie',
     'jalousien',
     'rollo',
     'rollos' ] }
[2017-07-03 17:24:42] { FHEMgutenMorgenIntent: 'gutenMorgen',
  FHEMguteNachtIntent: 'guteNacht' }
[2017-07-03 17:24:42] [FHEM] got: 2 results
[2017-07-03 17:24:42] [FHEM] mappings for Alexa.Party: { On:
   { reading: 'state',
     valueOff: '/off|A0|000000/',
     cmdOn: 'on',
     cmdOff: 'off' } }
[2017-07-03 17:24:42] [FHEM] Alexa.Party is switch
[2017-07-03 17:24:42] [FHEM] Alexa.Party has
[2017-07-03 17:24:42] [FHEM]   On [state;on,off]
  2017-07-03 17:24:42 caching: Alexa.Party-state: on
[2017-07-03 17:24:42] [FHEM] homebridgeMapping: On=state,valueOn=on,valueOff=off,cmdOn=on,cmdOff=off
[2017-07-03 17:24:42] [FHEM] mappings for Lampe11: { On:
   { valueOff: 'off',
     cmdOn: 'on',
     cmdOff: 'off',
     reading: 'state',
     valueOn: 'on' } }
[2017-07-03 17:24:42] [FHEM] Lampe11 is switch
[2017-07-03 17:24:42] [FHEM] Lampe11 has
[2017-07-03 17:24:42] [FHEM]   On [state;on,off]


Allerdings kommt die Fehlermeldung auch noch:
Zitatpi@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 Mo 2017-07-03 17:30:30 UTC; 6s ago
  Process: 18757 ExecStart=/opt/fhem/alexa-fhem/bin/alexa (code=exited, status=217/USER)
Main PID: 18757 (code=exited, status=217/USER)

Jul 03 17:30:30 fhem systemd[1]: Unit alexa.service entered failed state.

Warning: Unit file changed on disk, 'systemctl daemon-reload' recommended.
pi@fhem:~/alexa-fhem $

das könnte eventuell noch wichtig sein. Wenn ich mit dem nächsten Schritt weitermache, kommt folgendes zurück:
Zitatpi@fhem:~ $ sudo journalctl -u alexa
-- Logs begin at So 2017-07-02 21:35:21 UTC, end at Mo 2017-07-03 18:07:03 UTC.
Jul 02 21:35:21 fhem systemd[1]: Started Node.js Alexa Server.
Jul 02 21:35:21 fhem systemd[1]: alexa.service: main process exited, code=exited
Jul 02 21:35:21 fhem systemd[1]: Unit alexa.service entered failed state.
Jul 02 21:35:31 fhem systemd[1]: alexa.service holdoff time over, scheduling res
Jul 02 21:35:31 fhem systemd[1]: Stopping Node.js Alexa Server...
Jul 02 21:35:31 fhem systemd[1]: Starting Node.js Alexa Server...
Jul 02 21:35:31 fhem systemd[1]: Started Node.js Alexa Server.
Jul 02 21:35:31 fhem systemd[30515]: Failed at step USER spawning /opt/fhem/alex
Jul 02 21:35:31 fhem systemd[1]: alexa.service: main process exited, code=exited
Jul 02 21:35:31 fhem systemd[1]: Unit alexa.service entered failed state.
Jul 02 21:35:42 fhem systemd[1]: alexa.service holdoff time over, scheduling res
Jul 02 21:35:42 fhem systemd[1]: Stopping Node.js Alexa Server...
Jul 02 21:35:42 fhem systemd[1]: Starting Node.js Alexa Server...
Jul 02 21:35:42 fhem systemd[1]: Started Node.js Alexa Server.
Jul 02 21:35:42 fhem systemd[1]: alexa.service: main process exited, code=exited
Jul 02 21:35:42 fhem systemd[1]: Unit alexa.service entered failed state.
Jul 02 21:35:52 fhem systemd[1]: alexa.service holdoff time over, scheduling res
Jul 02 21:35:52 fhem systemd[1]: Stopping Node.js Alexa Server...
Jul 02 21:35:52 fhem systemd[1]: Starting Node.js Alexa Server...
Jul 02 21:35:52 fhem systemd[1]: Started Node.js Alexa Server.
Jul 02 21:35:52 fhem systemd[1]: alexa.service: main process exited, code=exited
Jul 02 21:35:52 fhem systemd[1]: Unit alexa.service entered failed state.
lines 1-23

Herzlichen Dank.

Kai
SPS, Arduino, Controllino, Sensortechnik, Elektronik

amenomade

Komisch:
ZitatJul 02 21:35:31 fhem systemd[30515]: Failed at step USER spawning /opt/fhem/alex


ZitatExecStart=/opt/fhem/alexa-fhem/bin/alexa (code=exited, status=217/USER)
Das ist typisch ein Berechtigungsproblem. Hab ich auch mal gehabt. Siehe hier: https://forum.fhem.de/index.php/topic,71612.msg631360.html#msg631360

Was ich nicht verstehe ist, warum Du alexa im Terminal in debug mode startest, aber hast auch Meldungen in journalctl. Stoppe die systemd Instanz
sudo systemctl stop alexa

und starte nur alexa im Terminal:
pi@fhem:~/alexa-fhem $ cd ~/alexa-fhem
pi@fhem:~/alexa-fhem $ ./bin/alexa --debug
[

Dann guck mal, ob die Alexa App Geräte findet, und ob alexa-fhem die Intents bekommt (im Terminal)
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus