i8beef / HomeAutio.Mqtt.GoogleHome

MIT License
215 stars 29 forks source link

PIN and Acknowledge challenge not working in Google Home App but via voice in Google Assistant #127

Closed fightforlife closed 3 years ago

fightforlife commented 3 years ago

Hello there,

this is more of a question than a real issue. I tried to lock one of my devices OnOff-Trait with a PIN challenge. Over Google Assistant via voice everything is working as expected. Google asks for my PIN before triggering the trait. But in the Google Home App on Android I am not asked for a PIN. And the trait is never triggered, because "status":"ERROR","errorCode":"challengeNeeded","challengeNeeded":{"type":"pinNeeded"}}]} (same for acknowledge)

To me this looks more like an issue on Googles side of things. Is there any expierence with this in the Google Home App?

Thanks in advance!

i8beef commented 3 years ago

Well, Google says: Google Assistant uses dialog to issue the challenge, but if you use Google Assistant on non-voice surfaces, PIN and confirmations are done on-screen. (https://developers.google.com/assistant/smarthome/develop/two-factor-authentication)

That appears to be a lie though in the Google Home app. I can't make a challenge work on mine either.

i8beef commented 3 years ago

Closing as a Google bug. You should report this to them on their bug tracker (if you can find it). Heres a few resources to help figure out where to report that (your guess is as good as mine, typical Google documentation / clarity).

https://developers.google.com/assistant/smarthome/support https://developers.google.com/assistant/support

balthus commented 2 years ago

Hello, I'm also looking for a way to secure some action with pincode. Does it work now? Would you have an example of a config entry to use so it can only be triggered after a valid pin code ?

Thanks :)

i8beef commented 2 years ago

On any given trait there will be a "challenge type" option. Just change that to PIN and set the appropriate option that pops up.

balthus commented 2 years ago

Hello, thanks for the answer, but I still can't get it :( I tried the following : ` "traits": [ { "trait": "action.devices.traits.OnOff",

    "commands": {
      "action.devices.commands.OnOff": {
        "on": "cmnd/tasmota-desktop-light/POWER"
      }
    },
    "state": {
      "on": {
        "topic": "cmnd/tasmota-desktop-light/POWER",
        "googleType": "bool",
        "valueMap": [
          {
            "mqtt": "ON",
            "type": "value",
            "google": "true"
          },
          {
            "mqtt": "OFF",
            "type": "value",
            "google": "false"
          }
        ]
      }
    },
  "challenge": "pinNeeded"

  }
],
"customData": null

}

` But it doesn't work. I also tried quite few combinations but I can't make it work. Could you share some code snippet to protect that trait with a pin code? Sorry if it's dumb question but already spent quite some time on it and lost quite few hairs ...

i8beef commented 2 years ago

The interface makes this easier, but this is the JSON that would get output for an OpenClose trait

        "trait": "action.devices.traits.OpenClose",
        "attributes": {
          "openDirection": [
            "UP",
            "DOWN"
          ],
          "queryOnlyOpenClose": false
        },
        "commands": {
          "action.devices.commands.OpenClose": {
            "openPercent": "MQTT_TOPIC"
          }
        },
        "state": {
          "openPercent": {
            "topic": "MQTT_TOPIC",
            "valueMap": [
              {
                "google": "100",
                "mqtt": "255",
                "type": "value"
              },
              {
                "google": "0",
                "mqtt": "0",
                "type": "value"
              }
            ]
          }
        },
        "challenge": {
          "type": "pin",
          "pin": "1234"
        }
balthus commented 2 years ago

Thanks for your quick reply, it works. :+1: I still don't fully understand how the mapping works

i8beef commented 2 years ago

If you need more help, open a new issue so we don't spam anyone else on unrelated stuff 😄