I’m writing python code to interact with Homey through the oauth web API.
All works up to the point where I want tot set a value for a device.
def set_target_temp(self, ts, temp):
if self.use_bearer():
id = self.get_device_id(ts)
url = 'http://192.168.1.93/api/manager/devices/device/'+id+'/capability/target_temperature/'
headr = {'Authorization': 'Bearer ' + self.bearer_token}
put_data = { "value": 13.0 }
response = requests.put(url=url, data=put_data, headers=headr)
if (response.status_code != 200):
return {"status": "failed"}
else:
return {"status": "ok"}
This return an HTTP 500 with:
{
"code": 500,
"error": "target_temperature InvalidTypeError: 13.0 is of type string but expected number (invalid_type)",
"error_description": "target_temperature InvalidTypeError: 13.0 is of type string but expected number (invalid_type)"
}
I also tried { “value”: “13” } with the same result.
Anyone ran into this before?
Frank