cjkrolak / ThermostatSupervisor

supervisor to detect and correct thermostat deviations
MIT License
0 stars 0 forks source link

nest: server spamming triggered #784

Open cjkrolak opened 8 months ago

cjkrolak commented 8 months ago

nest server detects spamming if too frequent calls are made to the server:

retreiving Google Nest credientials from .//credentials.json...
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\github\ThermostatSupervisor\thermostatsupervisor\nest.py", line 710, in <module>
    tc.print_select_data_from_all_zones(
  File "C:\github\ThermostatSupervisor\thermostatsupervisor\thermostat_common.py", line 1293, in print_select_data_from_all_zones
    Thermostat, Zone = create_thermostat_instance(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\github\ThermostatSupervisor\thermostatsupervisor\thermostat_common.py", line 1184, in create_thermostat_instance
    Thermostat = ThermostatClass(zone, verbose=verbose)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\github\ThermostatSupervisor\thermostatsupervisor\nest.py", line 91, in __init__
    self.devices = self.get_device_data()
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\github\ThermostatSupervisor\thermostatsupervisor\nest.py", line 109, in get_device_data
    self.devices = self.thermostat_obj.get_devices()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\cjkro\AppData\Local\Programs\Python\Python312\Lib\site-packages\nest\nest.py", line 307, in get_devices
    for device in self._devices:
                  ^^^^^^^^^^^^^
  File "C:\Users\cjkro\AppData\Local\Programs\Python\Python312\Lib\site-packages\nest\nest.py", line 288, in _devices
    self._devices_value = self._request('GET', '')['devices']
                          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\cjkro\AppData\Local\Programs\Python\Python312\Lib\site-packages\nest\nest.py", line 257, in _request
    raise APIError(r)
nest.nest.APIError: {'code': 429, 'message': 'Rate limited for the ListDevices API for the user.', 'status': 'RESOURCE_EXHAUSTED'}
cjkrolak commented 8 months ago

rate limits can be triggered by running basic checkout two times in a row. Rate limits for thermostats is 5 queries per minute or 100 queries per hour per this article: https://developers.google.com/nest/device-access/project/limits