[alexa-fhem | Generell] Alles zu Installation und damit verbundenen Problemen

Begonnen von prodigy7, 09 November 2016, 19:42:01

Vorheriges Thema - Nächstes Thema

Dhino

Sicher das du alle Schritte befolgt hast? Wenn man da unter: alexa-fhem aus fhem aus starten guckt sind da sehr viele Schritte zu befolgen nicht nur alexa in int.d anlegen

Dennis D.

#1621
Hallo zusammen,

habe ebenfalls ein Problem, alles ans laufen zu bekommen. Mittlerweile bin ich soweit, dass ich auf dem Cubie alles am laufen habe und er findet dort auch die Devices:


[7/15/2017, 3:20:26 PM] using /root/.alexa/config.json
[7/15/2017, 3:20:26 PM] ---
[7/15/2017, 3:20:26 PM] this is alexa-fhem 0.3.4
[7/15/2017, 3:20:26 PM] Fetching FHEM devices...
[7/15/2017, 3:20:26 PM] [FHEM] starting longpoll: http://localhost:8083/fhem?XHR=1&inform=type=status;addglobal=1;filter=.*;since=null;fmt=JSON&timestamp=1500124826458
[7/15/2017, 3:20:26 PM] Server listening on: https://:::3000
[7/15/2017, 3:20:26 PM] [FHEM] Checking devices and attributes...
[7/15/2017, 3:20:26 PM] [FHEM]   executing: http://localhost:8083/fhem?cmd=%7BAttrVal(%22global%22,%22userattr%22,%22%22)%7D&XHR=1
[7/15/2017, 3:20:26 PM] [FHEM]   executing: http://localhost:8083/fhem?cmd=jsonlist2%20TYPE=alexa&XHR=1
[7/15/2017, 3:20:26 PM] [FHEM] Fetching FHEM devices...
[7/15/2017, 3:20:26 PM] [FHEM] fetching: http://localhost:8083/fhem?cmd=jsonlist2%20room=Garten&XHR=1
[7/15/2017, 3:20:27 PM] [FHEM] alexa device is MyAlexa
[7/15/2017, 3:20:27 PM] [FHEM] MyAlexa is switch
[7/15/2017, 3:20:27 PM] [FHEM] MyAlexa has
[7/15/2017, 3:20:27 PM] [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
[7/15/2017, 3:20:27 PM] [FHEM]   executing: http://localhost:8083/fhem?cmd=%7B$defs%7BMyAlexa%7D-%3E%7B%22active%22%7D%20=%201%7D&XHR=1
[7/15/2017, 3:20:27 PM] [FHEM]   executing: http://localhost:8083/fhem?cmd=%7B$defs%7BMyAlexa%7D-%3E%7B%22alexa-fhem%20version%22%7D%20=%20%220.3.4%22%7D&XHR=1
[7/15/2017, 3:20:27 PM] [FHEM]   executing: http://localhost:8083/fhem?cmd=%7B$defs%7BMyAlexa%7D-%3E%7B%22active%22%7D%20=%200%7D&XHR=1
[7/15/2017, 3:20:27 PM] perfectOfVerb:
[7/15/2017, 3:20:27 PM] { stelle: 'gestellt',
  schalte: 'geschaltet',
  'färbe': 'gefärbt',
  mach: 'gemacht' }
[7/15/2017, 3:20:27 PM] verbsOfIntent:
[7/15/2017, 3:20:27 PM] [ OnIntent: [ 'schalte' ],
  prozentIntent: [ 'stelle' ],
  HueIntent: [ 'stelle' ],
  HueIntentB: [ 'färbe' ],
  SaturationIntent: [ 'stelle' ],
  SaturationIntentB: [ 'sättige' ],
  TargetPositionIntent: [ 'mach' ],
  gradIntent: [ 'stelle' ] ]
[7/15/2017, 3:20:27 PM] characteristicsOfIntent:
[7/15/2017, 3:20:27 PM] { OnIntent: [ 'On' ],
  prozentIntent: [ 'Brightness', 'TargetPosition', 'Volume' ],
  HueIntent: [ 'Hue' ],
  HueIntentB: [ 'Hue' ],
  SaturationIntent: [ 'Saturation' ],
  SaturationIntentB: [ 'Saturation' ],
  TargetPositionIntent: [ 'TargetPosition' ],
  gradIntent: [ 'TargetTemperature' ] }
[7/15/2017, 3:20:27 PM] prefixOfIntent:
[7/15/2017, 3:20:27 PM] { OnIntent: undefined,
  prozentIntent: 'auf',
  HueIntent: 'auf',
  HueIntentB: undefined,
  SaturationIntent: 'auf',
  SaturationIntentB: undefined,
  TargetPositionIntent: undefined,
  gradIntent: 'auf' }
[7/15/2017, 3:20:27 PM] suffixOfIntent:
[7/15/2017, 3:20:27 PM] { OnIntent: undefined,
  prozentIntent: 'prozent',
  HueIntent: undefined,
  HueIntentB: undefined,
  SaturationIntent: undefined,
  SaturationIntentB: undefined,
  TargetPositionIntent: undefined,
  gradIntent: 'grad' }
[7/15/2017, 3:20:27 PM] alexaTypes:
[7/15/2017, 3:20:27 PM] { light: [ 'licht', 'lampen' ],
  blind:
   [ 'rolladen',
     'rolläden',
     'jalousie',
     'jalousien',
     'rollo',
     'rollos' ] }
[7/15/2017, 3:20:27 PM] roomOfEcho:
[7/15/2017, 3:20:27 PM] {}
[7/15/2017, 3:20:27 PM] fhemIntents:
[7/15/2017, 3:20:27 PM] { FHEMgutenMorgenIntent: 'gutenMorgen',
  FHEMguteNachtIntent: 'guteNacht' }
[7/15/2017, 3:20:27 PM] [FHEM] got: 19 results
[7/15/2017, 3:20:27 PM] [FHEM] AA_Gartenbeleuchtung is switch
[7/15/2017, 3:20:27 PM] [FHEM] AA_Gartenbeleuchtung has
[7/15/2017, 3:20:27 PM] [FHEM]   On [state;on,off]
[7/15/2017, 3:20:27 PM] [FHEM] { reading: 'state',
  valueOff: '/off|A0|000000/',
  cmdOn: 'on',
  cmdOff: 'off',
  device: 'AA_Gartenbeleuchtung',
  informId: 'AA_Gartenbeleuchtung-state',
  characteristic_type: 'On',
  log:
   { [Function: bound ]
     debug: [Function],
     info: [Function],
     warn: [Function],
     error: [Function],
     log: [Function],
     prefix: 'FHEM' } }
  2017-07-15 15:20:27 caching: AA_Gartenbeleuchtung-state: off
...


Unter Alexa findet er jedoch keine Geräte. Im CloudWatch-Log gibt es jedoch nach dem suchen nach Geräten auch diverse Fehlermeldungen, die ich leider nicht interpretieren kann:


12:29:56 START RequestId: 4f6341ac-6959-11e7-a72f-753e85ae1821 Version: $LATEST
12:29:56 module initialization error: ReferenceError at Object.<anonymous> (/var/task/index.js:2:12) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17)
module initialization error: ReferenceError
at Object.<anonymous> (/var/task/index.js:2:12)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
12:29:56 END RequestId: 4f6341ac-6959-11e7-a72f-753e85ae1821
12:29:56 REPORT RequestId: 4f6341ac-6959-11e7-a72f-753e85ae1821 Duration: 34.18 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
12:29:57 START RequestId: 4ffa037b-6959-11e7-b624-a1aeebaf3770 Version: $LATEST
12:29:57 module initialization error: ReferenceError at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17)
module initialization error: ReferenceError
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
12:29:57 END RequestId: 4ffa037b-6959-11e7-b624-a1aeebaf3770
12:29:57 REPORT RequestId: 4ffa037b-6959-11e7-b624-a1aeebaf3770 Duration: 3.30 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
12:29:58 START RequestId: 50d8f129-6959-11e7-bab3-ab117900dc60 Version: $LATEST
12:29:58 module initialization error: ReferenceError at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17)
module initialization error: ReferenceError
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
12:29:58 END RequestId: 50d8f129-6959-11e7-bab3-ab117900dc60
12:29:58 REPORT RequestId: 50d8f129-6959-11e7-bab3-ab117900dc60 Duration: 0.68 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
12:55:08 START RequestId: d4d8b96c-695c-11e7-8d06-f7cd823ab4ea Version: $LATEST
12:55:08 module initialization error: ReferenceError at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17)
module initialization error: ReferenceError
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
12:55:08 END RequestId: d4d8b96c-695c-11e7-8d06-f7cd823ab4ea
12:55:08 REPORT RequestId: d4d8b96c-695c-11e7-8d06-f7cd823ab4ea Duration: 10.37 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 22 MB
13:14:46 START RequestId: 929f43b5-695f-11e7-ba18-b5c48b8ad499 Version: $LATEST
13:14:46 module initialization error: ReferenceError at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17)
module initialization error: ReferenceError
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
13:14:46 END RequestId: 929f43b5-695f-11e7-ba18-b5c48b8ad499
13:14:46 REPORT RequestId: 929f43b5-695f-11e7-ba18-b5c48b8ad499 Duration: 0.58 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 22 MB
13:14:47 START RequestId: 93408cc7-695f-11e7-975e-1fa81313c792 Version: $LATEST
13:14:47 module initialization error: ReferenceError at Module.require (module.js:353:17) at require (internal/module.js:12:17)
module initialization error: ReferenceError
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
13:14:47 END RequestId: 93408cc7-695f-11e7-975e-1fa81313c792
13:14:47 REPORT RequestId: 93408cc7-695f-11e7-975e-1fa81313c792 Duration: 0.51 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 22 MB
13:14:48 START RequestId: 9414a541-695f-11e7-81c5-112d3720d514 Version: $LATEST
13:14:48 module initialization error: ReferenceError at require (internal/module.js:12:17)
13:14:48 END RequestId: 9414a541-695f-11e7-81c5-112d3720d514


In der Lambda-Funktion habe ich die 50 Zeilen Code aus der Anleitung 1:1 rein kopiert und lediglich die beiden Konstanten für Host und Port angepasst. Gibt man Host und Port-Nummer im Browser ein, ist Alexa-Fhem auch zu erreichen. Kann mir hier jemand weiterhelfen?

VG
Dennis

[EDIT]
Habe es gelöst bekommen. Hatte die Host-Konstante im Lambda-Code falsch angegeben. Die ' fehlten. :-) Nun werden die Devices in Alexa erkannt.
FHEM 5.5 auf RPi Rev. B 512 mit HMLAN (HM-CFG-LAN)

CUL_HM: HM-LC-Bl1PBU-FM,HM-LC-SW1-BA-PCB,HM-LC-SW4-SM,HM-LC-Sw1PBU-FM,HM-OU-LED16,HM-PB-2-WM55,HM-RC-KEY3-B,HM-SEC-KEY,HM-SEC-RHS,HM-SEC-SC,HM-SEC-SD,HM-WDS10-TH-O,HM-WDS40-TH-I

OWDevice: DS18B20,DS2438

Marlen

Zitat von: Dhino am 16 Juli 2017, 08:59:42
Sicher das du alle Schritte befolgt hast? Wenn man da unter: alexa-fhem aus fhem aus starten guckt sind da sehr viele Schritte zu befolgen nicht nur alexa in int.d anlegen

Ich hab genau das gemacht, wie im WIKI beschrieben:
ZitatAlexa-Fhem aus FHEM heraus starten
Zunächst das Start-up-Skript aus diesem Post herunterladen https://forum.fhem.de/index.php/topic,60244.msg517271.html#msg517271 und unter /etc/init.d/alexa speichern.

Das Script geht davon aus, das der alexa-fhem script unter /opt/fhem/alexa-fhem liegt, und die logfiles später unter /opt/fhem/log. Sollte das nicht der Fall sein, muss das Skript angepasst werden.

Nun folgende Kommandos ausführen:

sudo chmod 755 /etc/init.d/alexa
sudo update-rc.d alexa defaults
In der Datei /etc/sudoers den User fhem für die Nutzung von sudo zulassen (sudo nano /etc/sudoers), z.B. durch Anfügen der nachfolgenden Zeile: fhem ALL=(ALL) NOPASSWD: ALL

Nun folgende Devices anlegen (ggf. einem Raum zuordnen, z.B. AlexaControl):

define FHEM.Alexa.Status dummy
define FHEM.Alexa dummy
attr FHEM.Alexa event-on-change-reading state
attr FHEM.Alexa webCmd status:start:stop:restart

define FHEM.Alexa.DOIF DOIF ([FHEM.Alexa] eq "start")
(set FHEM.Alexa on, {system ("sudo /etc/init.d/alexa start > /dev/null 2>&1 &")})
DOELSEIF ([FHEM.Alexa] eq "stop")
(set FHEM.Alexa on, {system ("sudo /etc/init.d/alexa stop > /dev/null 2>&1 &")})
DOELSEIF ([FHEM.Alexa] eq "restart")
(set FHEM.Alexa on, {system ("sudo /etc/init.d/alexa restart > /dev/null 2>&1 &")})
DOELSEIF ([FHEM.Alexa] eq "status")
(set FHEM.Alexa on, {system ("sudo /etc/init.d/alexa status > /dev/null 2>&1 &")})


Muss ich  nochwas machen?

LG
Marlen

Dhino

@ Marlen

Hast du Jessie auf dem Raspberry ? weil dann musst du unter dieser Anleitung gucken die du befolgt hast: Alexa-Fhem als Service (systemd) installieren <- vielleicht wird das dann klappen

Marlen

Ja, hab ich gesten versucht, aber dann hab ich irgendwas in der sudoer flasch gemacht!!!  :(

Siehe https://forum.fhem.de/index.php/topic,63636.0.html

Marlen

So, sudoers wieder repariert.

aber irgendwie läuft das nicht!

fhem@raspberrypi:~/alexa-fhem$ sudo systemctl start alexa
fhem@raspberrypi:~/alexa-fhem$ sudo systemctl status alexa
● alexa.service - Node.js Alexa Server
   Loaded: loaded (/etc/systemd/system/alexa.service; disabled)
   Active: active (exited) since Mon 2017-07-17 22:25:00 CEST; 34min ago

Jul 17 19:50:48 raspberrypi su[658]: pam_unix(su:session): session opened for user pi by (uid=0)
Jul 17 19:50:49 raspberrypi alexa[610]: Alexa starting
Jul 17 19:50:51 raspberrypi alexa[610]: Alexa is running PID 740
Jul 17 22:25:00 raspberrypi alexa[610]: script done
Jul 17 22:25:00 raspberrypi alexa[610]: script done
Jul 17 22:25:00 raspberrypi systemd[1]: Started LSB: Start daemon at boot time for alexa.
Jul 17 22:37:35 raspberrypi systemd[1]: Started LSB: Start daemon at boot time for alexa.
Jul 17 22:48:43 raspberrypi systemd[1]: Started LSB: Start daemon at boot time for alexa.
Jul 17 22:57:00 raspberrypi systemd[1]: Started LSB: Start daemon at boot time for alexa.
Jul 17 22:59:19 raspberrypi systemd[1]: Started Node.js Alexa Server.

Marlen

Hmmm...... wenn ich das mit den User Alexa start bekomme ich diese Meldung!


alexa@raspberrypi:/opt/fhem/alexa-fhem$ sudo systemctl start alexa
alexa@raspberrypi:/opt/fhem/alexa-fhem$ sudo systemctl status alexa
● alexa.service - Node.js Alexa Server
   Loaded: loaded (/etc/systemd/system/alexa.service; disabled)
   Active: activating (auto-restart) (Result: exit-code) since Mon 2017-07-17 23:15:12 CEST; 8s ago
  Process: 2701 ExecStart=/opt/fhem/alexa-fhem/bin/alexa $ALEXA_OPTS (code=exited, status=217/USER)
Main PID: 2701 (code=exited, status=217/USER)

Jul 17 23:15:12 raspberrypi systemd[1]: Unit alexa.service entered failed state.
alexa@raspberrypi:/opt/fhem/alexa-fhem$

amenomade

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

Marlen

Oder das fehlende WorkingDirectory!?

Mal noch eine andere Frage, (wenn ich es unter der Console starte läuft es ja):

Wenn ich sage: "Alexa, frage Smart Home nach Warmwasser!" Dann bekomme ich die Antwort: "Der Status Warmwasser beträgt 39,5°C"

Kann man die Antwort irgendwie anpassen?

Und, kann man das irgendwie machen, das wenn z.B. das Wasser <35° ist, Alexa gleich fragt ob ich es aufheizen möchte?

LG
  Marlen

Amenophis86

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...

Stefan M.

Zitat von: Stefan M. am 08 Juli 2017, 15:47:22
Hallo zusammen
ich möchte mir das Alexa Logfile in FHEM anzeigen lassen.
Ich habe es auch schon fast gelöst.

define AlexaLogfile FileLog ./log/alexa-%Y-%m.log fakelog

Aber ich muss noch jedes Monat bei einem neu erstellten Logfile die Rechte ändern.

Kann man das irgendwie vereinfachen ?
Ich meine ich habe es schon mal gelesen aber finde es nicht mehr.

LG
Stefan

Hallo zusammen
hat denn niemand einen Tipp für mich ?
LG
Stefan
FHEM auf 3 x RaspberryPi, 1 x Fritzbox,1 x Win. FS20 über CUL, HomeMatic über HMLan, 6 x  HM_CC_RT_DN,2 x HM_LC_BL1_FM,3 x HM_SEC_KEY,2 x HM_RC_Key4_2,7 x HM_SEC_SC,1 x HM_SEC_WDS,1 x HM_Sen_RD_O, 1x HM_Sen_Wa_Od,2 x HM_RC_Key4_2, 5 x HM-ES-PMSw1-Pl,1 x HM_LC_SW4_WM,1 x HM_SCI_3_FM

amenomade

- alexa unter dem User fhem laufen lassen
- oder mit umask spielen (siehe man umask)
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Marlen

Jetzt wollte ich in der Datei ~/.alexa/config.json
wie im WIKI beschreiben       
"auth": {"user": "fhem", "pass": "fhempassword"},


einfügen, aber dann hab ich keine Verbindung mehr!

Ich hab vor "auth" Leerzeichen gesetzt das es auf einer höhe ist

LG
  Marlen

Esjay

Zitat von: Marlen am 19 Juli 2017, 20:57:37
So schaut meine config.json aus:

{
    "alexa": {
        "port": 3000,
        "name": "Alexa TEST",
        "keyFile": "./key.pem",
        "certFile": "./cert.pem",
        "nat-pmp": "",
        "nat-upnp": false,
        4-bd69-0a7e0c0b69c8",
        "oauthClientID": d5eb65bcf"
    },

    "connections": [
        {
            "name": "FHEM",
            "server": "192.168.178.33",
            "auth": {"user": "fhem", "pass": "fhempassword"},
            "port": "8888",
            "webname": "fhem",
            "filter": "room=Alexa"
        }
    ]
}

Du müsstest dein Passwort ect. Schon eintragen, damit es funktioniert.Und der Port passt auch?Und verfremde mal deine ids!!!
Grüße

Marlen

Ja, klar, hab ich meinen User und Passwort, ich bin zwar blond, aber nicht blöd!  ;D