SwitchBotAPI
SwitchBotAPI copied to clipboard
Keypad createKey return 190 Cannot read properties of undefined (reading 'type')
Analysis
Can't create a new pass code for Keypad. Here my request :
POST https://api.switch-bot.com/v1.1/devices/KEYPAD_ID/commands
body= {
"commandType": "command",
"command": "createKey",
"parameters": {
"name": "TEST 123",
"type": "disposable",
"password": "12345678",
"startTime": 1716576575,
"endTime": 1716580175
}
}
headers={
"Authorization": "...",
"sign": "...=",
"nonce": "94926fe7e26f931842d9548f62ff6649",
"t": "1716577580988",
"Content-Type": "application/json",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
}
Response :
{
statusCode: 190,
body: {},
message: "Cannot read properties of undefined (reading 'type')"
}
Expected Behavior
I'm pretty sure few months ago I could do this. I expect this output :
{
"statusCode": 100,
"body": {
"commandId": "CMD..."
},
"message": "success"
}
Steps To Reproduce
- POST https://api.switch-bot.com/v1.1/devices/KEYPAD_ID/commands
Logs
No additional logs
Configuration
Here My keypad response on GET https://api.switch-bot.com/v1.1/devices/KEYPAD_ID/status:
{
"data": {
"statusCode": 100,
"body": {
"deviceId": "KEYPAD_ID",
"deviceType": "Keypad",
"hubDeviceId": "HUB_ID"
},
"message": "success"
}
}
Environment
Keypad firmware V1.8
Additional Context
Looks similar to #307 but I'm using V1.1. No response