mikejac / node-red-contrib-google-smarthome

A collection of Node-RED nodes to control your smart home devices via Google Assistant.
GNU General Public License v3.0
118 stars 37 forks source link

queryOnly devices can be controlled #404

Open NikAWing opened 1 year ago

NikAWing commented 1 year ago

Hey all!

I'm not sure if this is related to the smarthome node, a google bug or something generated by a dumb user ;)

I added 2 sensors, light and door and set both to queryOnly On/Off resp. Open/Close. This works, but in the google home app, if I click on the buttons there, it is not read-only, it immediately changes the state shown below the smarthome device nodes in NodeRed.

Is this a google problem or what can I do to just DISPLAY the state of the door and light/lux sensor? In this case I only need to know if it's open/closed or on/off but without being able to set something in the app.

Caprico85 commented 1 year ago

Hello @NikAWing

How are your devices configured? I have a window set as query only.

image

It correctly shows up as read only in the app.

image

NikAWing commented 1 year ago

for me it's kinda the same: grafik

But in the home app I can click on the buttons and see the reaction in node red. Or should I use sensor instead? It puzzles me that "query only" does not have "read only" attributes :)

Caprico85 commented 1 year ago

You are right. My first test was with the open/close trait. There it works. But with the on/off trait, query only is ignored and you can control the lights. I'll see if I can fix this.

Caprico85 commented 1 year ago

The parameters we send seems to be correct. But the whole logic around query/command only seems to be seriously broken by Google.

I experimented with several different traits, in the app or via voice, with querying and commanding. And I found no single trait that works all of the time.

Sometimes you can just query or control as if no "query/command only" was set. Sometimes actions are correctly denied, but with totally unrelated error messages like "This device is not set up". Sometimes you see the readonly icon in the app, sometimes you don't. And there's not even a recognizable pattern on what works and what does not.

So currently I am not able to fix this. I think I'll have to write a ticket on Google's official bugtracker.

NikAWing commented 1 year ago

Ok so it IS google related, thanks for checking! :)

I have also played around with devices and options (because I don't really find the simple ones I want to use) And yeah, the app also reacts weird, you can switch a light the 1st time to touch the button, the second time you touch it opens another window with a bigger switch and this also suddenly reacts to brightness levels etc which were not enabled in the node.

Currently it is (and I'm still a beginner with google smarthome) not easy for me to setup simple logic. Why don't they have an easy toggle/push button switch for example garage door opener, it is just a push button that triggers [direction1-stop-direction2-stop] or a simple 3state switch as in 1-off-2, so when you click on 2, 1 goes off, if you click on 1, 2 goes off and if you click on off, both are off.

I also noticed updating the switch nodes with "on:true/false" sometimes works and you see it in the app without reloading and for other switches of the same type and settings updating does not work until you refresh the app. But this makes it look that all problems are google related.

BTW, do you know any group/community where you can ask for help on how to set up things I just wrote about? I don't think opening an issue thread here for things like that is a good idea :)

Caprico85 commented 1 year ago

I opened an issue on Google's bugtracker regarding the "query only" issue: https://issuetracker.google.com/issues/296484985 Not sure if it helps though. The problem seems to exist for at least 3 years now: https://stackoverflow.com/questions/61955823/how-to-tell-google-to-not-send-execute-intents-for-sensor

  I'm having the same problems in the app. Mostly, I don't even send the current state of my devices into the app and use the Node-RED dashboard instead.

 

BTW, do you know any group/community where you can ask for help on how to set up things I just wrote about?

We have discussions enabled now for our repository, thanks to master @mikejac :-)

Caprico85 commented 1 year ago

Got a response from Google:

Dear Developer, Thank you for reaching out to us. Based on the details you've provided, it seems that the root cause of the problem lies in the implementation of error handling. Specifically, your backend server needs to respond with the error code functionNotSupported when the queryOnlyOnOff is set to true. To illustrate, let's consider the following scenario. Suppose the user sends a command to "turn off schreibtischlampe": { "requestId": "6314316342930951374", "payload": { "commands": [ { "ids": [ "475525b40c0b1b0f" ], "status": "ERROR", "errorCode": "functionNotSupported" } ] } }

We really don't send this error message. I'll fix that.

But I think this won't fix the whole problem. Sending this error will maybe fix the "device not set up" voice message when trying to control a read only device. But I guess it won't fix the buttons in the app. The buttons are already shown before we have a chance to send this functionNotSupported response.

Caprico85 commented 1 year ago

Still discussing with Google. This is reproducible on the Google Smart Home Playground. So the problem really is on Google's side and not a wrong implementation in our code.

NikAWing commented 1 year ago

that is great to know :) so the chances for an improvement or fix are good if the google staff looks further into it.

I've seen you've also enabled the github discussions area, that's great! I currently have to some IRL hardships to overcome and not much time, I will definitely join later and ask questions :)

Caprico85 commented 1 year ago

We're getting closer step by step...

Google answered that they are not able to reproduce this. So I did some more testing and noticed that this happens if Google Assistant is set to German or Dutch, but not if it is set to english. I hope, Google is now finally able to reproduce this.

Viele Grüße 😄

Caprico85 commented 11 months ago

It seems, Google has finally accepted this issue and will be working on it.

Dear Developer, We have passed this issue to our internal team and will continue to share updates on this issue thread. Thank you.

ckhmer1 commented 11 months ago

Great news, thanks. It also happens in Italian.