39_gassistant.pm (Google Assistant, Google Home)

Begonnen von dominik, 29 Januar 2019, 21:59:53

Vorheriges Thema - Nächstes Thema

elfrinjo

Hallo zusammen,

ich habe SONOFF/TASMOTA Geräte, die per MQTT mit FHEM verbunden sind, in Google Home aber den falschen Status anzeigen (immer an).
Der Grund scheint zu sein, das Google ein klein geschriebenes on/off erwartet, aus den Tasmotas aber ON/OFF herauskommt.

Meine Lösung dazu sieht so aus, dass ich den Status in ein eigenes Reading schreibe und dann mit stateFormat zurückhole

...
subscribeReading_mqttstate     home/sonoff/sonoff-4567/POWER
stateFormat                    {(lc ReadingsVal($name,"mqttstate","error") )}
...


Die Fragen dazu:
- Hat jemand eine schönere/elegantere Lösung?
- Wäre es sinnvoll diese Konversion im Modul durchzuführen?

Viele Grüße, Jörg


dominik

Mit welchen Modul hast du das Device eingebunden? Poste mal die Ausgabe von jsonlist2 device.

Nachdem SONOFF/TASMOTA sicher fuer mehr User interessant ist, kann ich es gleich in FHEM Connect richtig verarbeiten.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

elfrinjo

Aber gern, es ist ein einfaches MQTT Device...



{
  "Arg":"lgt_wz_lichtSofa1",
  "Results": [
  {
    "Name":"lgt_wz_lichtSofa1",
    "PossibleSets":"off on",
    "PossibleAttrs":"alias comment:textField-long eventMap:textField-long group room suppressReading userReadings:textField-long verbose:0,1,2,3,4,5 IODev qos retain publishSet publishSet_.* subscribeReading_.* autoSubscribeReadings useSetExtensions:1,0 event-aggregator event-min-interval event-on-change-reading event-on-update-reading oldreadings stateFormat:textField-long timestamp-on-change-reading assistantName:textField cmdIcon devStateIcon devStateIcon:textField-long devStateStyle gassistantName:textField genericDeviceType:ac_unit,aircondition,airfreshener,airpurifier,awning,bathtub,bed,blender,blinds,boiler,camera,closet,coffee_maker,coffeemaker,cooktop,curtain,dehumidifier,dehydrator,dishwasher,door,drawer,dryer,fan,faucet,fireplace,fryer,garage,gate,grill,heater,hood,humidifier,kettle,light,lock,mop,mower,microwave,multicooker,outlet,oven,pergola,petfeeder,pressurecooker,radiator,refrigerator,scene,securitysystem,shutter,shower,sousvide,sprinkler,standmixer,switch,thermostat,vacuum,valve,washer,waterheater,window,yogurtmaker homebridgeMapping:textField-long icon realRoom:textField sortby webCmd webCmdLabel:textField-long widgetOverride lightSceneParamsToSave lightSceneRestoreOnlyIfChanged:1,0 userattr",
    "Internals": {
      "FUUID": "5c434372-f33f-6db9-e6bd-f4e4264351ca7123",
      "NAME": "lgt_wz_lichtSofa1",
      "NR": "119",
      "STATE": "on",
      "TYPE": "MQTT_DEVICE",
      "retain": "*:1 "
    },
    "Readings": {
      "mqttstate": { "Value":"ON", "Time":"2020-02-16 20:49:13" },
      "state": { "Value":"on", "Time":"2020-02-16 20:49:13" },
      "transmission-state": { "Value":"subscription acknowledged", "Time":"2020-02-16 20:52:37" }
    },
    "Attributes": {
      "IODev": "mqtt",
      "alias": "Lampe Sofa",
      "devStateIcon": "on:general_an@green:off off:general_aus@red:on off:general_aus@grey:on on:general_an@grey:off",
      "genericDeviceType": "light",
      "group": "Wohnzimmer",
      "publishSet": "on off home/sonoff/sonoff-4567/cmnd/POWER",
      "retain": "1",
      "room": "Controls,GoogleAssistant",
      "stateFormat": "{(lc ReadingsVal($name,\"mqttstate\",\"error\") )}",
      "subscribeReading_mqttstate": "so59/sonoff/sonoff-4567/POWER",
      "webCmd": "on:off"
    }
  }  ],
  "totalResultsReturned":1
}

dominik

Nutzt du kein attrTemplate dafuer? Mit attrTemplate waere es wahrscheinlich einfach zu identifizieren.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

elfrinjo

Zitat von: dominik am 16 Februar 2020, 21:42:28
Nutzt du kein attrTemplate dafuer? Mit attrTemplate waere es wahrscheinlich einfach zu identifizieren.

Oh interessant, das kannte ich noch gar nicht.
Das MQTT2 Device schaue ich mir die Tage mal an. es sieht aus als könnte das die ganze Sache deutlcih vereinfachen.

dominik

Ja, das denke ich auch :) Melde dich dann gerne wieder wenn es nicht sofort funktioniert. Mein Ziel ist es, dass solche Standarddevices ohne jegliche Konfiguration laufen.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

zontorro

Hallo Dominik,
zuerst vielen Dank für deine Arbeit, die Einrichtung des Moduls und die Einbindung meiner Thermostate hat schnell und problemlos funktioniert 👍🏼.
Zu meiner Frage: Gibt es die Möglichkeit den Google Assistant in FHEM konstruierte Texte sprechen zu lassen? (Evtl. Über statusReport? Den Punkt habe ich noch nicht verstanden...)

Hintergrund ist, dass ich mir die 3 günstigsten meiner Standard-Tankstellen einschließlich der Preise ausgeben lassen möchte. Die Spritpreise werden in FHEM getrackt. Ich könnte auch ein Dummy-Device anlegen das stets den zu sprechenden Text als state/reading speichert.

Grüße, zontorro

AndreasK

N'Abend!

Ich habe nodejs removed und neu installiert. Es funktioniert weiterhin nicht.

Beim Start von gassistant-fhem kommt nun:


pi@raspberrypi:~ $ gassistant-fhem
Loading cli.js...
Loading version.js...
Loading server.js...
Loading user.js...
Loading logger.js...
Loading fhem.js...
Loading database.js...
/usr/lib/node_modules/gassistant-fhem/node_modules/vm2/lib/main.js:522
throw this._internal.Decontextify.value(e);
^

Error: Failed to load gRPC binary module because it was not installed for the current system
Expected directory: node-v64-linux-arm-glibc
Found: [node-v67-linux-arm-glibc]
This problem can often be fixed by running "npm rebuild" on the current system
Original error: Cannot find module '/usr/lib/node_modules/gassistant-fhem/node_modules/grpc/src/node/extension_binary/node-v64-linux-arm-glibc/grpc_node.node'
    at Object.<anonymous> (/usr/lib/node_modules/gassistant-fhem/node_modules/grpc/src/grpc_extension.js:53:17)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/lib/node_modules/gassistant-fhem/node_modules/grpc/src/client_interceptors.js:144:12)
    at Module._compile (internal/modules/cjs/loader.js:778:30)



Auf meinem Pi läuft
Rasbian 8 (Jessie)

Ist das das Problem?
Ich habe kaum Vorstellungen davon, wie ich es sicher update...


Zitat von: dominik am 16 Februar 2020, 09:42:05
Probier zuerst sudo apt remove und danach neu installieren.

Wenn das nicht geht, dann schau ob du deine Linux Distro auf buster ist.


@mmili, danke fuer das Feedback, freut mich, dass es so gut ankommt :)

dominik

Zitat von: zontorro am 18 Februar 2020, 16:17:36
Hallo Dominik,
zuerst vielen Dank für deine Arbeit, die Einrichtung des Moduls und die Einbindung meiner Thermostate hat schnell und problemlos funktioniert 👍🏼.
Zu meiner Frage: Gibt es die Möglichkeit den Google Assistant in FHEM konstruierte Texte sprechen zu lassen? (Evtl. Über statusReport? Den Punkt habe ich noch nicht verstanden...)

Hintergrund ist, dass ich mir die 3 günstigsten meiner Standard-Tankstellen einschließlich der Preise ausgeben lassen möchte. Die Spritpreise werden in FHEM getrackt. Ich könnte auch ein Dummy-Device anlegen das stets den zu sprechenden Text als state/reading speichert.

Grüße, zontorro

Mit dem GOOGLECAST Modul in Kombination kannst du das loesen.

Zitat von: AndreasK am 18 Februar 2020, 18:37:29
N'Abend!

Ich habe nodejs removed und neu installiert. Es funktioniert weiterhin nicht.

Beim Start von gassistant-fhem kommt nun:


pi@raspberrypi:~ $ gassistant-fhem
Loading cli.js...
Loading version.js...
Loading server.js...
Loading user.js...
Loading logger.js...
Loading fhem.js...
Loading database.js...
/usr/lib/node_modules/gassistant-fhem/node_modules/vm2/lib/main.js:522
throw this._internal.Decontextify.value(e);
^

Error: Failed to load gRPC binary module because it was not installed for the current system
Expected directory: node-v64-linux-arm-glibc
Found: [node-v67-linux-arm-glibc]
This problem can often be fixed by running "npm rebuild" on the current system
Original error: Cannot find module '/usr/lib/node_modules/gassistant-fhem/node_modules/grpc/src/node/extension_binary/node-v64-linux-arm-glibc/grpc_node.node'
    at Object.<anonymous> (/usr/lib/node_modules/gassistant-fhem/node_modules/grpc/src/grpc_extension.js:53:17)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/lib/node_modules/gassistant-fhem/node_modules/grpc/src/client_interceptors.js:144:12)
    at Module._compile (internal/modules/cjs/loader.js:778:30)



Auf meinem Pi läuft
Rasbian 8 (Jessie)

Ist das das Problem?
Ich habe kaum Vorstellungen davon, wie ich es sicher update...



Mach bitte auch ein
sudo npm uninstall -g gassistant-fhem
sudo npm install -g gassistant-fhem

Wenn es dann noch immer nicht laeuft: Google nach raspberrypi update jessie to buster
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

zontorro

Zitat von: dominik am 18 Februar 2020, 19:18:06
Mit dem GOOGLECAST Modul in Kombination kannst du das loesen.

Das funktioniert dann aber nur mit einem Google Home/Chromecast und nicht mit meinem Handy von unterwegs direkt im Google Assistant, oder?

SouzA

Das ist richtig.
Das chromecast-modul ist ja in deinem heimischen Netz mit den chromecasts verbunden.

Bis denn
SouzA
Raspi 4, EnOcean TCM310 USB, HM-MOD-UART-USB, Jeelink, hue, AMAD, fully, FRITZBOX, Signalbot, VIERA, Presence BT/Mac, TPLink, Gassistant, Shelly, fhempy, ZigBee

zontorro

Dann muss ich mich nach einer anderen Lösung umschauen, ich hätte gerne, dass ich es auch vom Handy aus z.B. im Auto nutzen kann.

dominik

Leider bietet da Google noch keine andere Moeglichkeit an, vielleicht kommt ja irgendwann noch eine solche Moeglichkeit.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

dominik

Google unterstuetzt nun auch Zonenreinigung bei Saugrobotern. Nutzt das jemand von euch?

Wenn ja, wie lauten die Befehle fuer die Zonenreinigung beim Device? Mit ein paar Beispielen, koennte ich das integrieren.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

S7EN

#1544
Hallo,

leider bekomme ich auch nach mehrmaliger Neuinstallation immer wieder das selbe Fehlerbild.
Gassistant verbindet sich nicht mit Google Home. Nach er erstmaligen Installation erscheint in der App auch der Dummy-Schalter, nur schalten lässt er sich nicht. Das Plugin versucht ständig sich zu verbinden und endet mit "stopped". Node ist aktuell, Raspbian (stretch) ist aktuell und fhem ist auch aktuell. Hier mal ein Logauszug mit der Hoffnung ihr könnt mir helfen (vollständiger Log im Anhang):

Loading cli.js...
Loading version.js...
Loading server.js...
Loading user.js...
Loading logger.js...
Loading fhem.js...
Loading database.js...
Loading cli.js...
Loading version.js...
Loading server.js...
Loading user.js...
Loading logger.js...
Loading fhem.js...
Loading database.js...
Loading localserver.js...
Loading localhandleEXECUTE.js...
[21.2.2020, 08:20:37] using ./gassistant-fhem.cfg
[21.2.2020, 08:20:37] ---
[21.2.2020, 08:20:37] config:
{"connections":[{"webname":"fhem","name":"FHEM","filter":"room=GoogleAssistant","port":"8083","server":"127.0.0.1","auth":{"pass":"XXX","user":"XXX"}}],"gassistant":{"description":"FHEM Connect"}}

[21.2.2020, 08:20:37] ---
[21.2.2020, 08:20:37] Google Assistant FHEM Connect 2.3.0 started
[21.2.2020, 08:20:37] Fetching FHEM connections...
[21.2.2020, 08:20:37] [FHEM] starting longpoll: http://127.0.0.1:8083/fhem?XHR=1&inform=type=status;addglobal=1;filter=.*;since=null;fmt=JSON×tamp=1582269637773
[21.2.2020, 08:20:39] [FHEM]   executing: http://127.0.0.1:8083/fhem?cmd=jsonlist2%20TYPE%3Dgassistant&fwcsrf=csrf_495655773174863&XHR=1
[21.2.2020, 08:20:39] [FHEM] FHEM Google Assistant device detected: gassistant
[21.2.2020, 08:20:39] [FHEM]   executing: http://127.0.0.1:8083/fhem?cmd=setreading%20gassistant%20gassistant-fhem-version%202.3.0&fwcsrf=csrf_495655773174863&XHR=1
[21.2.2020, 08:20:39] [FHEM]   executing: http://127.0.0.1:8083/fhem?cmd=setreading%20gassistant%20gassistant-fhem-lastServerError%20none&fwcsrf=csrf_495655773174863&XHR=1
[21.2.2020, 08:20:39] [FHEM]   executing: http://127.0.0.1:8083/fhem?cmd=set%20gassistant%20loginURL%20https%3A%2F%2Ffhemconnector.eu.auth0.com%2Fauthorize%3Faudience%3Dhttps%3A%2F%2Feurope-west1-fhem-ga-connector.cloudfunctions.net%2F%26scope%3Doffline_access%2520openid%2520profile%26response_type%3Dcode%26client_id%3DEI0TI2Y0W1743Ico53Nvsg1FsmoZniCC%26code_challenge%3DMXyZ9_HAvMN9RvfxBNXh3QOPQhdlHiRq2HeCXkk9LKM%26code_challenge_method%3DS256%26redirect_uri%3Dhttps%3A%2F%2Feurope-west1-fhem-ga-connector.cloudfunctions.net%2Fcodelanding%2Fstart&fwcsrf=csrf_495655773174863&XHR=1
[21.2.2020, 08:20:39] [FHEM] Get refresh token...
[21.2.2020, 08:20:39] [FHEM]   executing: http://127.0.0.1:8083/fhem?cmd=get%20gassistant%20refreshToken&fwcsrf=csrf_495655773174863&XHR=1
[21.2.2020, 08:20:40] [FHEM]   executing: http://127.0.0.1:8083/fhem?cmd=setreading%20gassistant%20gassistant-fhem-connection%20connecting...&fwcsrf=csrf_495655773174863&XHR=1
[21.2.2020, 08:20:40] [FHEM] Found refresh token in reading
[21.2.2020, 08:20:40] [FHEM]   executing: http://127.0.0.1:8083/fhem?cmd=setreading%20gassistant%20gassistant-fhem-versionAvailable%202.3.0&fwcsrf=csrf_495655773174863&XHR=1
[21.2.2020, 08:20:42] Refresh tokens finished. Next refresh in 86400 seconds.
[21.2.2020, 08:20:42] [FHEM] refreshAllTokens executed
[2020-02-21T07:20:43.113Z]  @firebase/firestore: Firestore (7.8.1): INTERNAL UNHANDLED ERROR:  TypeError: __PRIVATE_protoLoader.HP is not a function
    at __PRIVATE_loadProtos (/usr/lib/node_modules/gassistant-fhem/node_modules/@firebase/firestore/dist/index.node.cjs.js:1:330205)
    at t.SE (/usr/lib/node_modules/gassistant-fhem/node_modules/@firebase/firestore/dist/index.node.cjs.js:1:330592)
    at t.bE (/usr/lib/node_modules/gassistant-fhem/node_modules/@firebase/firestore/dist/index.node.cjs.js:1:279708)
    at /usr/lib/node_modules/gassistant-fhem/node_modules/@firebase/firestore/dist/index.node.cjs.js:1:277473
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:17710) UnhandledPromiseRejectionWarning: TypeError: __PRIVATE_protoLoader.HP is not a function
    at __PRIVATE_loadProtos (/usr/lib/node_modules/gassistant-fhem/node_modules/@firebase/firestore/dist/index.node.cjs.js:1:330205)
    at t.SE (/usr/lib/node_modules/gassistant-fhem/node_modules/@firebase/firestore/dist/index.node.cjs.js:1:330592)
    at t.bE (/usr/lib/node_modules/gassistant-fhem/node_modules/@firebase/firestore/dist/index.node.cjs.js:1:279708)
    at /usr/lib/node_modules/gassistant-fhem/node_modules/@firebase/firestore/dist/index.node.cjs.js:1:277473
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:17710) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
....


Edit: Werde mal auf Buster updaten und schauen was passiert