0

I’m trying to toggle the microphone with an API call by setting microphoneEnabled to false or true but it doesn't seem to be having any effect.

It's listed in the docs but can't seem to get it to work.

Here's an example call I'm making

curl --request POST \
  --url https://api.ecobee.com/1/thermostat \
  --header 'Authorization: Bearer eyJ......' \
  --header 'Content-Type: application/json' \
  --data '{
  "selection": {
    "selectionType": "registered",
    "selectionMatch": ""
  },
  "thermostat": {
        "audio": {
            "microphoneEnabled": true
        },
    "settings": {
      "autoAway": true,
      "followMeComfort": true
    }
  }
}'

Any tips would be most appreciated!

Mendel
  • 575
  • 3
  • 16
  • Did you perform your authentication? Did you obtain the Access Token and Refresh Token? How are you passing the json request (curl)? What was the response to the call? Please show the full command with variables – rr0ss0rr Aug 02 '23 at 02:57
  • Yes to both of those. The call works fine for the other settings changes like "auto away". I'm running the API call via iOS shortcuts - so no code in particular to share. This is simply the payload I use along with the auth. – Mendel Aug 03 '23 at 03:35
  • Clarification ... Do you want to enable or disable "audio". You mentioned that you want to disable the audio, but your json is turning it on. Otherwise, The json looks fine, If you have access to a desktop and curl then I would issue the request from there and see what the ecobee response is. The api doc is lacking with examples, but it does show you what the curl request should look like – rr0ss0rr Aug 03 '23 at 16:08
  • Sorry for the confusion. I'm trying to use my API call to toggle it off or on and I pasted the request for toggling it on. I updated the question to clarify and also pasted in an example curl request I tried (I only removed the bearer token in the example) – Mendel Aug 03 '23 at 16:26
  • Can you just run a query to your ecobee? Take the curl request above and add the following 2 lines to "selection": `includeRuntime=true` and `includeSettings=true` and remove the "thermostat" section. Does "audio" show up? – rr0ss0rr Aug 03 '23 at 17:39
  • You can take a look at one of my questions that I had trying to interface with the ecobee. [link](https://stackoverflow.com/questions/71114496/ecobee-api-thermostat-request-json-using-bash-and-curl?rq=2). What fixed it for me was to encode the json through curl's `--data-urlencode` option – rr0ss0rr Aug 03 '23 at 17:50
  • Like this? ``` curl --request POST \ --url https://api.ecobee.com/1/thermostat \ --header 'Authorization: Bearer eyJhbGcXXXXXXYpw' \ --header 'Content-Type: application/json' \ --cookie 'did=s%253Av0%253A713fd000-354f-11ee-be25-fdfb0d4d08f0.GqwKlyd%252BUC7imVsU33ZhsnRCRd3Uz2WK7DznacA0DyI; did_compat=s%253Av0%253A713fd000-354f-11ee-be25-fdfb0d4d08f0.GqwKlyd%252BUC7imVsU33ZhsnRCRd3Uz2WK7DznacA0DyI' \ --data '{ "selection": { "selectionType": "registered", "selectionMatch": "", "includeRuntime": true, "includeSettings": true } }' ``` – Mendel Aug 07 '23 at 18:25
  • The curl at the bottom of the answer is all you need for the query. Just add your access token – rr0ss0rr Aug 09 '23 at 01:00

1 Answers1

0

Looking at the API doc link, it looks like "audio" is its own object. Your json shows "audio" under the "thermostat" object. Try the following:

{
    "selection": {
        "selectionType": "registered",
        "selectionMatch": ""
    },
    "audio": {
        "microphoneEnabled": true
    },
    "thermostat": {
        "settings": {
            "autoAway": true,
            "followMeComfort": true
        }
    }
}

Well ... the API Doc is crap ... Looks like your original json seems to be valid

{
    "selection": {
        "selectionType": "registered",
        "selectionMatch": ""
    },
    "thermostat": {
        "audio": {
            "microphoneEnabled": true
        },
        "settings": {
            "autoAway": true,
            "followMeComfort": true
        }
    }
}

The only other thing is that "audio" is only valid on Ecobee v4 thermostats.

You can query the audio settings from the following request:

{"selection":{"selectionType":"registered","selectionMatch":null,"includeAudio":true}}

and the curl with percent-encoding the json"

curl -s  'https://api.ecobee.com/1/thermostat?json=%7B%22selection%22%3A%7B%22selectionType%22%3A%22registered%22%2C%22selectionMatch%22%3Anull%2C%22includeAudio%22%3Atrue%7D%7D' -H 'Authorization: Bearer ACCESS_TOKEN'
rr0ss0rr
  • 154
  • 1
  • 6