Add support for Pilote v2
This commit is contained in:
11
plugin.py
11
plugin.py
@@ -345,10 +345,10 @@ class BasePlugin:
|
|||||||
"Set the device mode using the Heatzy API"
|
"Set the device mode using the Heatzy API"
|
||||||
if Devices[2].nValue != mode:
|
if Devices[2].nValue != mode:
|
||||||
mode_str = {
|
mode_str = {
|
||||||
HEATZY_MODE_VALUE['NORMAL']: '[1,1,0]',
|
HEATZY_MODE_VALUE['NORMAL']: 0, #'[1,1,0]',
|
||||||
HEATZY_MODE_VALUE['ECONOMY']: '[1,1,1]',
|
HEATZY_MODE_VALUE['ECONOMY']: 1, #'[1,1,1]',
|
||||||
HEATZY_MODE_VALUE['FROSTFREE']: '[1,1,2]',
|
HEATZY_MODE_VALUE['FROSTFREE']: 2, #'[1,1,2]',
|
||||||
HEATZY_MODE_VALUE['OFF']: '[1,1,3]'
|
HEATZY_MODE_VALUE['OFF']: 3, #'[1,1,3]',
|
||||||
}
|
}
|
||||||
headers = {
|
headers = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@@ -356,7 +356,8 @@ class BasePlugin:
|
|||||||
'X-Gizwits-User-token': self.token,
|
'X-Gizwits-User-token': self.token,
|
||||||
'X-Gizwits-Application-Id': 'c70a66ff039d41b4a220e198b0fcc8b3',
|
'X-Gizwits-Application-Id': 'c70a66ff039d41b4a220e198b0fcc8b3',
|
||||||
}
|
}
|
||||||
data = '{"raw": '+mode_str[mode]+'}'
|
#data = '{"raw": '+mode_str[mode]+'}'
|
||||||
|
data = f'{"attrs": {"mode":{mode_str[mode]}}}'
|
||||||
url = f"https://euapi.gizwits.com/app/control/{self.did}"
|
url = f"https://euapi.gizwits.com/app/control/{self.did}"
|
||||||
try:
|
try:
|
||||||
response = requests.post(url, headers=headers, data=data, timeout=3).json()
|
response = requests.post(url, headers=headers, data=data, timeout=3).json()
|
||||||
|
|||||||
Reference in New Issue
Block a user