FilipDem / Domoticz-NEST-plugin

NEST Plugin for Domoticz using the Google credentials.
13 stars 4 forks source link

KeyError in nest.py #2

Closed wboerhout closed 4 years ago

wboerhout commented 4 years ago

I followed the instructions on installing the plugin and adding the token and cookie. This is the result:

pi@raspi2` ~ $ python3 /opt/domoticz/plugins/nest.py
Traceback (most recent call last):
File "/opt/domoticz/plugins/nest.py", line 232, in <module> thermostat.GetNestCredentials()
File "/opt/domoticz/plugins/nest.py", line 147, in GetNestCredentials
self._UseBearerTokenToGeAccessTokenAndUserId()
File "/opt/domoticz/plugins/nest.py", line 119, in _UseBearerTokenToGeAccessTokenAndUserId
self.nest_user_id = result['claims']['subject']['nestId']['id']
KeyError: 'nestId'

What am I missing?

Python stuff:

pi@raspi2 ~ $ dpkg-query --show | grep python3
libpython3-dev:armhf    3.7.3-1
libpython3-stdlib:armhf 3.7.3-1
libpython3.5-minimal:armhf      3.5.4-4
libpython3.7:armhf      3.7.3-2
libpython3.7-dev:armhf  3.7.3-2
libpython3.7-minimal:armhf      3.7.3-2
libpython3.7-stdlib:armhf       3.7.3-2
python3 3.7.3-1
python3-apt     1.8.4
python3-asn1crypto      0.24.0-1
python3-certifi 2018.8.24-1
python3-cffi-backend    1.12.2-1
python3-chardet 3.0.4-3
python3-colorzero       1.1
python3-crypto  2.6.1-9+b1
python3-cryptography    2.6.1-3+deb10u2
python3-dbus    1.2.8-3
python3-debconf 1.5.71
python3-dev     3.7.3-1
python3-distro-info     0.21
python3-distutils       3.7.3-1
python3-entrypoints     0.3-1
python3-gi      3.30.4-1
python3-gpiozero        1.5.1
python3-idna    2.6-1
python3-keyring 17.1.1-1
python3-keyrings.alt    3.1.1-1
python3-lib2to3 3.7.3-1
python3-minimal 3.7.3-1
python3-pip     18.1-5+rpt1
python3-pkg-resources   40.8.0-1
python3-requests        2.21.0-1
python3-rpi.gpio        0.7.0~buster-1
python3-secretstorage   2.3.1-2
python3-setuptools      40.8.0-1
python3-six     1.12.0-1
python3-spidev  20170223~145721-2
python3-urllib3 1.24.1-1
python3-wheel   0.32.3-2
python3-xdg     0.25-5
python3.5-minimal       3.5.4-4
python3.7       3.7.3-2
python3.7-dev   3.7.3-2
python3.7-minimal       3.7.3-2

PIP stuff:

pi@raspi2 ~ $ pip3 list
Package             Version
------------------- ----------
asn1crypto          0.24.0
certifi             2019.11.28
chardet             3.0.4
colorzero           1.1
cryptography        2.6.1
distro-info         0.21
entrypoints         0.3
gpiozero            1.5.1
idna                2.8
keyring             17.1.1
keyrings.alt        3.1.1
pip                 18.1
pycrypto            2.6.1
PyGObject           3.30.4
python-apt          1.8.4
pyxdg               0.25
requests            2.22.0
RPi.GPIO            0.7.0
rpl                 1.5.6
SecretStorage       2.3.1
setuptools          40.8.0
six                 1.12.0
spidev              3.3
unattended-upgrades 0.1
urllib3             1.25.7
wheel               0.32.3
FilipDem commented 4 years ago

I suppose the credentials are not good seen the tag 'nestId' is not found in the answer. I would recommend to print once the answer and analyse it further. Be aware that this plugin is a considered for me as a workaround... It really analyses the communication with Nest/Google. If something changes in the protocol, it could lead to problems. On the other hand, Google announced that an official API will only be available by the end the year... So there are no real good solutions.

wboerhout commented 4 years ago

Thanks Filip. I have been thinking this over. First question after logging in to Nest with my Google account was: do you want to migrate to Google now? I said no. But: is this workaround for migrated accounts, or for not-migrated accounts? The reason I'm trying this at all, is, I do not want to migrate my account, and the old Domoticz connection with the Nest API key stopped working a while ago.

FilipDem commented 4 years ago

This is only working for migrated accounts... I didn't want to migrate either... However I bought a new phone and re-installed the APPs... And there I made an error while re-installing the NEST app. It migrated my account without I really wanted... Hence this workaround solution. So if you are not migrated, it is logic that this plugin does not work.

wboerhout commented 4 years ago

That was my conclusion as well. Thanks for confirming. I learned a few things in the process though...