Hey,
Able to get the devices list but not device status.
device list response:
{'__v': 0,
'_id': '678374678d93eb54339241ea',
'deviceTypes': ['LED Bulb'],
'devices': [],
'enabled': True,
'firmwareVersion': 70,
'isArchived': False,
'mqttPassword': '35129998af',
'name': 'Test 1',
'notificationOn': False,
'registrationDate': '2025-01-12T07:51:03.710Z',
'remoteCodes': [],
'switchType': 'SWITCH',
'toggleDelay': 250,
'typeId': {'__v': 1,
'_id': '6492bfa0bd2d2710b97b9f97',
'amazonReviewLink': 'https://www.amazon.in/review/create-review/?asin=B08QF5WVN2',
'features': ['SWITCH|RECIEVER'],
'gtype': 'action.devices.types.SWITCH',
'long_name': '1 Node Smart Switch',
'name': 'WIFI_SWITCH_V3',
'numberOfRelays': 1,
'primary': True,
'toggleDelay': 0,
'traits': ['action.devices.traits.OnOff']},
'userId': '678373fa7d1f205d94a4772c',
'uuidRef': {'__v': 0,
'_id': '678374678d93eb54339241ee',
'byUserId': '678373fa7d1f205d94a4772c',
'createdOn': '2025-01-12T07:51:03.874Z',
'enabled': True,
'hasTransmitter': False,
'typeId': '6492bfa0bd2d2710b97b9f97',
'uuid': '2828758'}}
code of status:
device_id = jdata[0]['typeId']["_id"]
relay_no = jdata[0]['typeId']['__v']
headers["Content-Type"] ="application/json"
device_state_url = f"{BASE_URL}v2/devices/{device_id}/state?deviceNumber={relay_no}"
print(device_state_url)
response = requests.request("GET", device_state_url , data="", headers=headers)
print(response)
Output:
https://backend.tinxy.in/v2/devices/6492bfa0bd2d2710b97b9f97/state?deviceNumber=1
<Response [500]>