Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Has anybody done anything with Sensibo Sky?

If you have a question or need help, this is the place to be.
Post Reply
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: Has anybody done anything with Sensibo Sky?

Post by Mastiff »

Thanks! The get scripts work, but the set script doesn't. At least the temp and mode doesn't.

Code: Select all

20:55:19      Traceback (most recent call last):
20:55:19        Python script "258", line 25, in <module>
20:55:19          deviceDict = json.loads(jString)
20:55:19        File "json\__init__.pyc", line 339, in loads
20:55:19        File "json\decoder.pyc", line 364, in decode
20:55:19        File "json\decoder.pyc", line 382, in raw_decode
20:55:19      ValueError: No JSON object could be decoded

Code: Select all

20:55:54      Traceback (most recent call last):
20:55:54        Python script "254", line 25, in <module>
20:55:54          deviceDict = json.loads(jString)
20:55:54        File "json\__init__.pyc", line 339, in loads
20:55:54        File "json\decoder.pyc", line 364, in decode
20:55:54        File "json\decoder.pyc", line 382, in raw_decode
20:55:54      ValueError: No JSON object could be decoded
I can't test on/off now, because my renters are in the appartment, and they might not like me turning on or off their heat when it's cold outside. :mrgreen:

I think I'll set the get measurements into work at once, it's nice to have an extra temp sensor in the room. :mrgreen:
User avatar
yokel22
Experienced User
Posts: 265
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Has anybody done anything with Sensibo Sky?

Post by yokel22 »

I thought that might be the case. I'm not totally sure how they're wanting the data sent on the set commands. I'll try it another way & see if that works.

I'm not sure what they charge for their measurement pods just thought i'd mention this. You could make something like this for around $20 US with either a pi Zero w or arduino board. kg even posted an arduino example in the tutorials section.
Last edited by yokel22 on Tue Feb 06, 2018 8:06 pm, edited 1 time in total.
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: Has anybody done anything with Sensibo Sky?

Post by Mastiff »

Thanks! Oh, btw, I tried with both 20 and '20'.
User avatar
yokel22
Experienced User
Posts: 265
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Has anybody done anything with Sensibo Sky?

Post by yokel22 »

Try this set temp script.

Code: Select all

import requests
import json

# change this value.  If this errors, try 20.
setTemp = '20'

params = {}
params['apiKey'] = eg.globals.sensiboKey
params['targetTemperature'] = setTemp

# command paths
baseUrl = 'https://home.sensibo.com/api/v2'
devices = '/users/me/pods'
measurement = '/pods/' + eg.globals.sensiboDeviceId1 + '/measurements'
state = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates'
setTemperature = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/targetTemperature=' + setTemp
setOnOff = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/on'
setMode = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/mode'
setFan = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/fanLevel'


# First request to get devices/id
response = requests.patch(baseUrl + setTemperature, params = params)
jString = response.content
deviceDict = json.loads(jString)

print deviceDict
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: Has anybody done anything with Sensibo Sky?

Post by Mastiff »

Still erring out, I'm afraid. Another line this time:

Code: Select all

21:25:12      Traceback (most recent call last):
21:25:12        Python script "261", line 25, in <module>
21:25:12          deviceDict = json.loads(jString)
21:25:12        File "json\__init__.pyc", line 339, in loads
21:25:12        File "json\decoder.pyc", line 364, in decode
21:25:12        File "json\decoder.pyc", line 382, in raw_decode
21:25:12      ValueError: No JSON object could be decoded
User avatar
yokel22
Experienced User
Posts: 265
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Has anybody done anything with Sensibo Sky?

Post by yokel22 »

I'll play around with it a bit more. I may have to reach out to the only api support they have, a facebook url. Don't have a facebook account though :mrgreen: .

BTW, these days i think skipping the super bowl would earn DT's praise. He'd still go on about how big & beautiful his wall is gonna be though. :(
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: Has anybody done anything with Sensibo Sky?

Post by Mastiff »

Yeah, right. The knealers... They're almost as bad as the dreamers! :mrgreen: But no problem. I'll wait, no hurry on my part.
User avatar
yokel22
Experienced User
Posts: 265
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Has anybody done anything with Sensibo Sky?

Post by yokel22 »

One more to try. You'll need to run the get device state script before running any of the set commands. This will set the global variable for current state which is required for the set commands. I'm not sure why it requires this, but that's the way the code appears to function.

Code: Select all

import requests
import json

# change this value.  If this errors, try 2.
setTemp = '20'

params = {}
params['apiKey'] = eg.globals.sensiboKey

# command paths
baseUrl = 'https://home.sensibo.com/api/v2'
devices = '/users/me/pods'
measurement = '/pods/' + eg.globals.sensiboDeviceId1 + '/measurements'
state = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates'
setTemperature = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/targetTemperature'
setOnOff = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/on'
setMode = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/mode'
setFan = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/fanLevel'

setData = json.dumps({'currentAcState': eg.globals.sensiboLastState, 'newValue': setTemp})

response = requests.patch(baseUrl + setTemperature, params = params, data=setData)
jString = response.content
deviceDict = json.loads(jString)

print deviceDict
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: Has anybody done anything with Sensibo Sky?

Post by Mastiff »

I'm afraid not. I guessed that you still meant "try 20", not 2, but I did try 2 as well as both versions of 20. No luck with that either.

Code: Select all

08:38:29      Traceback (most recent call last):
08:38:29        Python script "266", line 24, in <module>
08:38:29          deviceDict = json.loads(jString)
08:38:29        File "json\__init__.pyc", line 339, in loads
08:38:29        File "json\decoder.pyc", line 364, in decode
08:38:29        File "json\decoder.pyc", line 382, in raw_decode
08:38:29      ValueError: No JSON object could be decoded
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Has anybody done anything with Sensibo Sky?

Post by kgschlosser »

Try this.

Code: Select all

import requests
import json

# change this value.  If this errors, try 2.
setTemp = '20'

params = {}
params['apiKey'] = eg.globals.sensiboKey

# command paths
baseUrl = 'https://home.sensibo.com/api/v2'
devices = '/users/me/pods'
measurement = '/pods/' + eg.globals.sensiboDeviceId1 + '/measurements'
state = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates'
setTemperature = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/targetTemperature'
setOnOff = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/on'
setMode = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/mode'
setFan = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/fanLevel'


setData = json.dumps({'currentAcState': eg.globals.sensiboLastState, 'newValue': setTemp}).encode('UTF-8')

response = requests.patch(baseUrl + setTemperature, params = params, data=setData)
jString = response.content
deviceDict = json.loads(jString.decode('utf-8'))
print json.dumps(deviceDict, indent=4)

If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Has anybody done anything with Sensibo Sky?

Post by kgschlosser »

and why requests.patch???
If you like the work I have been doing then feel free to Image
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: Has anybody done anything with Sensibo Sky?

Post by Mastiff »

Code: Select all

08:49:24      Traceback (most recent call last):
08:49:24        Python script "276", line 25, in <module>
08:49:24          deviceDict = json.loads(jString.decode('utf-8'))
08:49:24        File "json\__init__.pyc", line 339, in loads
08:49:24        File "json\decoder.pyc", line 364, in decode
08:49:24        File "json\decoder.pyc", line 382, in raw_decode
08:49:24      ValueError: No JSON object could be decoded
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Has anybody done anything with Sensibo Sky?

Post by kgschlosser »

and I am not sure why you are using patch. I have never seen this actually implemented. But since you are and you are using JSON objects You are not using JSON Patch. This could be the problem possibly???

http://jsonpatch.com/
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Has anybody done anything with Sensibo Sky?

Post by kgschlosser »

OK so lets see what the actual output is

Code: Select all


import requests
import json

# change this value.  If this errors, try 2.
setTemp = '20'

params = {}
params['apiKey'] = eg.globals.sensiboKey

# command paths
baseUrl = 'https://home.sensibo.com/api/v2'
devices = '/users/me/pods'
measurement = '/pods/' + eg.globals.sensiboDeviceId1 + '/measurements'
state = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates'
setTemperature = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/targetTemperature'
setOnOff = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/on'
setMode = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/mode'
setFan = '/pods/' + eg.globals.sensiboDeviceId1 + '/acStates/fanLevel'


setData = json.dumps({'currentAcState': eg.globals.sensiboLastState, 'newValue': setTemp}).encode('UTF-8')

response = requests.patch(baseUrl + setTemperature, params = params, data=setData)
jString = response.content

print jString.decode('utf-8')

# deviceDict = json.loads(jString.decode('utf-8'))
# print json.dumps(deviceDict, indent=4)

If you like the work I have been doing then feel free to Image
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: Has anybody done anything with Sensibo Sky?

Post by Mastiff »

With '20':

Code: Select all

08:58:36      <html><head><title>400 BadRequest - Sensibo</title></head><body><h>400 BadRequest</h><p>parameter 'newValue' invalid: must be int, received 20</p><body></html>
So it has to be the integer 20. Which gives this:

Code: Select all

08:58:48      <html><head><title>400 BadRequest - Sensibo</title></head><body><h>400 BadRequest</h><p>parameter 'newValue' invalid: Missing swing in AcState(on=True, mode=heat, temp=20C, fan=auto) (capabilities: RemoteCapabilities: {'modes': {'dry': {'temperatures': {'celsius': [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, 'swing': ['stopped', 'rangeFull']}, 'auto': {'swing': ['stopped', 'rangeFull'], 'temperatures': {'celsius': [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, 'fanLevels': ['low', 'medium_low', 'medium', 'medium_high', 'high', 'auto']}, 'heat': {'swing': ['stopped', 'rangeFull'], 'temperatures': {'celsius': [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, 'fanLevels': ['low', 'medium_low', 'medium', 'medium_high', 'high', 'auto']}, 'fan': {'swing': ['stopped', 'rangeFull'], 'fanLevels': ['low', 'medium_low', 'medium', 'medium_high', 'high', 'auto']}, 'cool': {'swing': ['stopped', 'rangeFull'], 'temperatures': {'celsius': [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, 'fanLevels': ['low', 'medium_low', 'medium', 'medium_high', 'high', 'auto']}}})</p><body></html>
Post Reply