Skip to content

https://api.switch-bot.com/v1.1/scenes returning inconsistent results #435

@MartinMartinov

Description

@MartinMartinov

Analysis

Hello,

I've been using the API for about 2 years now without any problem, but I recently started encountering a weird problem when pinging the scenes endpoint.  Not consistently, and I can't figure out what determines the response I get, but sometimes I get this response instead of my actual scenes:

{'statusCode': 100, 'body': [{'sceneId': 'e9c0e4b8-f42b-44df-a78b-e5052ca059a9', 'sceneName': 'Away Timer'}, {'sceneId': 'T01-202311051051-42770763', 'sceneName': 'Blinds Close'}, {'sceneId': 'T01-202311051052-03879961', 'sceneName': 'Blinds Open'}], 'message': 'success'}

Expected Behavior

{'statusCode': 100, 'body': [{'sceneId': 'd12d1bc4-7aa0-4acd-94f4-bbb6ff5c6d3f', 'sceneName': 'Heat Garage'}, {'sceneId': '13e61baf-d54c-40b3-8693-8e3a89501b52', 'sceneName': 'Alarm Start'}, {'sceneId': '3f17d748-c78b-4d83-84d1-1a456b016f1e', 'sceneName': 'Alarm Stop'}, {'sceneId': 'ac8d7721-62d9-41ee-8c12-f0500243abad', 'sceneName': 'Night Light'}, {'sceneId': '44c0cf31-4d02-4b05-a1d8-c4ca3543fe95', 'sceneName': 'Lights Off'}, {'sceneId': '2a33292e-d067-4d42-8df5-a4d27f8ef449', 'sceneName': 'Toggle Bedroom Light'}], 'message': 'success'}

Steps To Reproduce

Ping https://api.switch-bot.com/v1.1/scenes

Logs

`{'statusCode': 100, 'body': [{'sceneId': 'e9c0e4b8-f42b-44df-a78b-e5052ca059a9', 'sceneName': 'Away Timer'}, {'sceneId': 'T01-202311051051-42770763', 'sceneName': 'Blinds Close'}, {'sceneId': 'T01-202311051052-03879961', 'sceneName': 'Blinds Open'}], 'message': 'success'}`

versus

`{'statusCode': 100, 'body': [{'sceneId': 'd12d1bc4-7aa0-4acd-94f4-bbb6ff5c6d3f', 'sceneName': 'Heat Garage'}, {'sceneId': '13e61baf-d54c-40b3-8693-8e3a89501b52', 'sceneName': 'Alarm Start'}, {'sceneId': '3f17d748-c78b-4d83-84d1-1a456b016f1e', 'sceneName': 'Alarm Stop'}, {'sceneId': 'ac8d7721-62d9-41ee-8c12-f0500243abad', 'sceneName': 'Night Light'}, {'sceneId': '44c0cf31-4d02-4b05-a1d8-c4ca3543fe95', 'sceneName': 'Lights Off'}, {'sceneId': '2a33292e-d067-4d42-8df5-a4d27f8ef449', 'sceneName': 'Toggle Bedroom Light'}], 'message': 'success'}`

Configuration

self.base_url = "https://api.switch-bot.com/"
self.headers = {
  "Authorization": token,
  "Content-Type": "application/json; charset=utf8",
  "t": str(t),
  "sign": str(sign, "utf-8"),
  "nonce": str(nonce),
}
url = f"{self.base_url}v1.1/scenes"

Environment

  • OS: PyOS
  • Software: Python
  • Node: v14.21.3
  • npm: 6.14.18

Additional Context

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions