Page 1 of 2

Sensibo through dzVents  [Solved]

Posted: Saturday 24 August 2019 13:07
by elmortero
Hi all,

Just got my Sensibos to control the Aircon in my home
There was a solution for Domoticz using a LUA script, combined with a python script and module but I prefer dzvents.
Thank you Bob123Bob for the inspiration!

Sharing the script:
This script relies on 4 virtual switches:
* ON/OFF switch This is the only switch that triggers the script and changes to sensibo are only sent when this one changes
Type of switch: Virtual Switch

* A MODE switch to select the function of the AC.
Type of switch: Selector switch
levels : Heat, Cool, Fan, Dry and Auto
* fan level to choose the speed of the fan.
Type of switch: Selector switch.
Levels: Low, Medium, High, Auto. Some ACs have levels inbetween those (Medium low, Medium High)
* desired temperature

Code: Select all

return {
	on = {
		devices = { 'AC Salon' },
		httpResponses = { 'sensibosalon' } -- matches callback string below
	},
	
	execute = function(domoticz, triggerItem)
	local device_id = 'YYYY' --salon
	local api_key = 'ZZZZZ'
--define related switches
		local ac_state = domoticz.devices('AC Salon')
		local ac_mode = domoticz.devices('Mode Salon')
		local ac_fan_level = domoticz.devices('Fan Salon')
		local ac_salon_termo = domoticz.devices('ACtemp Salon')

    local function boo() -- the on parameter must be passed as a boolean. This function does that
    	if ac_state.state == 'On' then
    		return true
    	else
    		return false	
    	end
    end
--get the levels from the related switches
	local acmode = ac_mode.levelName
	local flevel = ac_fan_level.levelName
	local set_temp = domoticz.utils.round(ac_salon_termo.setPoint, 0)

	preppostData = {
		acState = {
				on =  boo(),
				targetTemperature = set_temp,
				mode = acmode,
				fanLevel = flevel[attachment=0]sensiSalon.PNG[/attachment]
				}
	}
	--domoticz.utils.dumpTable(preppostData)	
		if (triggerItem.isDevice) then
			domoticz.openURL({
				url = 'https://home.sensibo.com/api/v2/pods/'..device_id..'/acStates?apiKey='..api_key,
				method = 'POST',
				callback = 'sensibosalon',
				postData = preppostData
			})
			
		elseif (triggerItem.isHTTPResponse) then

	local response = triggerItem
		if (response.ok and response.isJSON) then
		   print('Command sent OK to sensibosalon')

			else
				print('**sensibosalon failed to fetch info')
			end
		end
	end
}


Re: Sensibo through dzVents

Posted: Thursday 29 August 2019 11:21
by Mozart
Hi,

Thanks for sharing your script. I'm about to order a sensibo for my AC so this comes in handy :)

How did you add the sensibo to domoticz? I checked the hardware list but do not see it in there.
Never mind, I found the plugin already :)

Re: Sensibo through dzVents

Posted: Thursday 29 August 2019 14:18
by elmortero
Mozart wrote: Thursday 29 August 2019 11:21 Never mind, I found the plugin already :)
Hi, I don't use the plugin. That is why I made this script, I access the Sensibo API directly

Re: Sensibo through dzVents

Posted: Thursday 05 December 2019 10:50
by EdwinDaems
Hi all,

After bying me the Sensibo at black friday I'd thought about hooking it up to my Domoticz.
So I found this thread which was the best fit for me.

First step is to generate the API key which you can then use within the script.
To generate yours go to: https://home.sensibo.com/me/api
Fill in a name like "Domoticz Airco Livingroom" and click on generate.

Then you need your Device ID which you can find using the following url using your API key:
https://home.sensibo.com/api/v2/users/m ... zzzzzzzzzz
Between the results you'll find the following where yyyyy is your Device ID
"isOwner": true, "serial": "xxxxx", "id": "yyyyy", "firmwareVersion": "SKY30044

Next, create the virtual switches as described by elmortero in this thread.
I've used Airco, Airco temperatuur, Airco fan and Airco mode for the naming of the switches.
Change the icons if you like by editing the virtual switches and change the Selector Level names according to the options you have for your device.
All options can be found using https://home.sensibo.com/api/v2/users/m ... zzzzzzzzzz
Mostly Heat, Cool, Fan, Dry, Auto and Low, Medium, High, Auto will suffice.

I've changed the script a bit to make sure the script is run also when changing the fanspeed, mode or temperature.
You should only change yyyyy and zzzzz if you named your virtual switches the same as I did (Airco, Airco temperatuur, Airco fan, Airco mode)

Thank you elmortero for putting your effort in your previous DzVents script.

Code: Select all

return {
	on = {
		devices = { 'Airco', 'Airco temperatuur', 'Airco fan', 'Airco mode' },
		httpResponses = { 'Airco' } -- matches callback string below
	},
	
	execute = function(domoticz, triggerItem)
	local device_id = 'yyyyy' --salon
	local api_key = 'zzzzz'
--define related switches
		local ac_state = domoticz.devices('Airco')
		local ac_mode = domoticz.devices('Airco mode')
		local ac_fan_level = domoticz.devices('Airco fan')
		local ac_salon_termo = domoticz.devices('Airco temperatuur')

    local function boo() -- the on parameter must be passed as a boolean. This function does that
    	if ac_state.state == 'On' then
    		return true
    	else
    		return false	
    	end
    end
--get the levels from the related switches
	local acmode = ac_mode.levelName
	local flevel = ac_fan_level.levelName
	local set_temp = domoticz.utils.round(ac_salon_termo.setPoint, 0)

	preppostData = {
		acState = {
				on =  boo(),
				targetTemperature = set_temp,
				mode = acmode,
				fanLevel = flevel
				}
	}
	--domoticz.utils.dumpTable(preppostData)	
		if (triggerItem.isDevice) then
			domoticz.openURL({
				url = 'https://home.sensibo.com/api/v2/pods/'..device_id..'/acStates?apiKey='..api_key,
				method = 'POST',
				callback = 'Airco',
				postData = preppostData
			})
			
		elseif (triggerItem.isHTTPResponse) then

	local response = triggerItem
		if (response.ok and response.isJSON) then
		   print('Command sent OK to Airco')

			else
				print('**Airco failed to fetch info')
			end
		end
	end
}

Re: Sensibo through dzVents

Posted: Wednesday 15 April 2020 15:56
by Thelion
Hi,

Have been using this script for quite some time now, but since the upgrade to Domotivz 4.11665, the HTTP request to Sensibo returns "Error: (3.0.1) HTTP/1.1 response: 400 ==>> Bad Request" in dzVents.

When opening the generated URL in a browser and even with curl from the command-line, the information is displayed without issues.

Code: Select all

 2020-04-15 15:48:22.339 Status: User: Admin initiated a switch command (121/AC Kleedkamer/Off)
2020-04-15 15:48:22.426 Status: dzVents: Debug: Dumping domoticz data to /home/pi/domoticz/scripts/dzVents/domoticzData.lua
2020-04-15 15:48:22.504 Status: dzVents: Debug: Processing device-adapter for AC Kleedkamer: Switch device adapter
2020-04-15 15:48:22.504 Status: dzVents: Debug: dzVents version: 2.5.7
2020-04-15 15:48:22.504 Status: dzVents: Debug: Event triggers:
2020-04-15 15:48:22.505 Status: dzVents: Debug: - Device: AC Kleedkamer
2020-04-15 15:48:22.542 Status: dzVents: Info: Handling events for: "AC Kleedkamer", value: "Off"
2020-04-15 15:48:22.543 Status: dzVents: Info: ------ Start internal script: Sensibo: Device: "AC Kleedkamer (Dummy)", Index: 121
2020-04-15 15:48:22.544 Status: dzVents: Debug: Processing device-adapter for Mode Kleedkamer: Switch device adapter
2020-04-15 15:48:22.545 Status: dzVents: Debug: Processing device-adapter for Fan Kleedkamer: Switch device adapter
2020-04-15 15:48:22.546 Status: dzVents: Debug: Processing device-adapter for ACtemp Kleedkamer: Thermostat setpoint device adapter
2020-04-15 15:48:22.546 Status: dzVents: Debug: OpenURL: url = https://home.sensibo.com/api/v2/pods/xxxxxxxx/acStates?apiKey=xxxxxxxx
2020-04-15 15:48:22.546 Status: dzVents: Debug: OpenURL: method = POST
2020-04-15 15:48:22.546 Status: dzVents: Debug: OpenURL: post data = {"acState":{"fanLevel":"High","mode":"Heat","on":false,"targetTemperature":27.0}}
2020-04-15 15:48:22.546 Status: dzVents: Debug: OpenURL: headers = {["Content-Type"]="application/json"}
2020-04-15 15:48:22.546 Status: dzVents: Debug: OpenURL: callback = sensibokleedkamer
2020-04-15 15:48:22.547 Status: dzVents: Info: ------ Finished Sensibo
2020-04-15 15:48:22.547 Status: dzVents: Debug: Commands sent to Domoticz:
2020-04-15 15:48:22.547 Status: dzVents: Debug: - OpenURL = {["postdata"]="{"acState":{"fanLevel":"High","mode":"Heat","on":false,"targetTemperature":27.0}}", ["headers"]={["Content-Type"]="application/json"}, ["URL"]="https://home.sensibo.com/api/v2/pods/xxxxxxxx/acStates?apiKey=xxxxxxxx", ["_trigger"]="sensibokleedkamer", ["method"]="POST"}
2020-04-15 15:48:22.547 Status: dzVents: Debug: =====================================================
2020-04-15 15:48:23.215 Status: dzVents: Debug: Event triggers:
2020-04-15 15:48:23.215 Status: dzVents: Debug: - HTTPResponse: sensibokleedkamer
2020-04-15 15:48:23.249 Status: dzVents: Info: Handling httpResponse-events for: "sensibokleedkamer"
2020-04-15 15:48:23.249 Status: dzVents: Info: ------ Start internal script: Sensibo: HTTPResponse: "sensibokleedkamer"
2020-04-15 15:48:23.264 Status: dzVents: Debug: Processing device-adapter for AC Kleedkamer: Switch device adapter
2020-04-15 15:48:23.265 Status: dzVents: Debug: Processing device-adapter for Mode Kleedkamer: Switch device adapter
2020-04-15 15:48:23.266 Status: dzVents: Debug: Processing device-adapter for Fan Kleedkamer: Switch device adapter
2020-04-15 15:48:23.267 Status: dzVents: Debug: Processing device-adapter for ACtemp Kleedkamer: Thermostat setpoint device adapter
2020-04-15 15:48:23.267 Status: dzVents: **sensibokleedkamer failed to fetch info
2020-04-15 15:48:23.267 Status: dzVents: Info: ------ Finished Sensibo
2020-04-15 15:48:23.755 Status: dzVents: Debug: dzVents version: 2.5.7
2020-04-15 15:48:23.249 Error: dzVents: Error: (3.0.1) HTTP/1.1 response: 400 ==>> Bad Request
2020-04-15 15:48:32.838 Status: dzVents: Debug: Dumping domoticz data to /home/pi/domoticz/scripts/dzVents/domoticzData.lua
Any ideas on how to solve this?

Re: Sensibo through dzVents

Posted: Wednesday 15 April 2020 16:10
by waaren
Thelion wrote: Wednesday 15 April 2020 15:56 Have been using this script for quite some time now, but since the upgrade to Domotivz 4.11665, the HTTP request to Sensibo returns "Error: (3.0.1) HTTP/1.1 response: 400 ==>> Bad Request" in dzVents.

When opening the generated URL in a browser and even with curl from the command-line, the information is displayed without issues.

Any ideas on how to solve this?
Not sure what happens here but in domoticz V4.11665 dzVents 2.5.7 is included, Some of your error messages are from a dzVents version 3.0.1
So it seems you have mixed versions on your system.

Re: Sensibo through dzVents

Posted: Wednesday 15 April 2020 16:43
by Thelion
waaren wrote: Wednesday 15 April 2020 16:10
Thelion wrote: Wednesday 15 April 2020 15:56 Have been using this script for quite some time now, but since the upgrade to Domotivz 4.11665, the HTTP request to Sensibo returns "Error: (3.0.1) HTTP/1.1 response: 400 ==>> Bad Request" in dzVents.

When opening the generated URL in a browser and even with curl from the command-line, the information is displayed without issues.

Any ideas on how to solve this?
Not sure what happens here but in domoticz V4.11665 dzVents 2.5.7 is included, Some of your error messages are from a dzVents version 3.0.1
So it seems you have mixed versions on your system.
I possibly do have an explanation for that. This is not my own Domoticz system and the user upgraded to the v11666 of Domoticz, but after that, Domoticz didn't run any more, due to Debian Jessie. I got a re-compiled executable 11665 from the forum (https://www.domoticz.com/forum/viewtopi ... ok#p235192) and with that, Domoticz started again.

This can explain the different dzVents version.

I'm not looking to upgrade the system remotely to buster, that's why this work-around.

Re: Sensibo through dzVents

Posted: Wednesday 15 April 2020 18:03
by waaren
Thelion wrote: Wednesday 15 April 2020 16:43 This can explain the different dzVents version.
I'm not looking to upgrade the system remotely to buster, that's why this work-around.
OK. I would not be surprised then if you will see more problems coming.
dzVents being one area but also stuf in the www / Config / scripts directory's are integrated with the domoticz version.

In the same dropbox map where you got the compiled version for stretch I now added a zip file containing the domoticz sub directories. With these directories you can align the domoticz executable.

Re: Sensibo through dzVents

Posted: Saturday 18 April 2020 2:09
by Thelion
waaren wrote: Wednesday 15 April 2020 18:03 In the same dropbox map where you got the compiled version for stretch I now added a zip file containing the domoticz sub directories. With these directories you can align the domoticz executable.
Will have a go with that, thank.

Re: Sensibo through dzVents

Posted: Saturday 18 April 2020 15:31
by Thelion
waaren wrote: Wednesday 15 April 2020 18:03 In the same dropbox map where you got the compiled version for stretch I now added a zip file containing the domoticz sub directories. With these directories you can align the domoticz executable.
I copied your files over and the dzVents version are now the same and all is working, but the error is the same unfortunately.

Code: Select all

 Error: dzVents: Error: (2.5.7) HTTP/1.1 response: 400 ==>> Bad Request

Re: Sensibo through dzVents

Posted: Saturday 18 April 2020 17:22
by waaren
Thelion wrote: Saturday 18 April 2020 15:31

Code: Select all

 Error: dzVents: Error: (2.5.7) HTTP/1.1 response: 400 ==>> Bad Request
Can you show the exact Curl and browser commands the does work on the same system.
Did it work from dzVents on the now failing system before.
Does it work on your own system with this dzVents version ?

Re: Sensibo through dzVents

Posted: Saturday 18 April 2020 17:51
by Thelion
waaren wrote: Saturday 18 April 2020 17:22

Code: Select all

 Error: dzVents: Error: (2.5.7) HTTP/1.1 response: 400 ==>> Bad Request
Can you show the exact Curl and browser commands the does work on the same system.
Did it work from dzVents on the now failing system before.
Does it work on your own system with this dzVents version ?
The when using the curl command "curl https://home.sensibo.com/api/v2/pods/xx ... xxxxxxxxxx" from the command-line, it produces:

Code: Select all

{
  "status": "success",
  "moreResults": true,
  "result": [
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "2TYDtE8xi7",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "9BbRVGUPZF",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "qRLXMmtQ96",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "jJR2bQUSgy",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "2hBoZ5JRN3",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "txJ6XuE9kC",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [
        "on"
      ],
      "id": "q9KQrUaZni",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": true,
        "targetTemperature": 27,
        "temperatureUnit": "C",
        "mode": "heat",
        "fanLevel": "high"
      },
      "changedProperties": [
        "on"
      ],
      "id": "qt78fZAGz5",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "kbJHcUK8pH",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "hajT8qJ3YV",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "7jx6BWgbjF",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "gfN8M4JBGS",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "eW9wSYeXhp",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "fv3FmYh6je",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "JedShBsgwX",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "cH948LuC7G",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "tnw6MK9ayP",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "ff7UrWSkEU",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [
        "on"
      ],
      "id": "E95c6fHUMa",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": true,
        "targetTemperature": 27,
        "temperatureUnit": "C",
        "mode": "heat",
        "fanLevel": "high"
      },
      "changedProperties": [
        "on"
      ],
      "id": "uXi2Vbrou2",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "pEvkQpEXUi",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "vXJJV7WBKT",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "SD4J6ogWHQ",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "KcWioeJmMz",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "BArFyGH5dc",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [
        "on"
      ],
      "id": "BuqQdCXq8y",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": true,
        "targetTemperature": 27,
        "temperatureUnit": "C",
        "mode": "heat",
        "fanLevel": "high"
      },
      "changedProperties": [
        "on"
      ],
      "id": "Ji6XV6F4z3",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [
        "on"
      ],
      "id": "Rgn2h5aqcL",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": true,
        "targetTemperature": 27,
        "temperatureUnit": "C",
        "mode": "heat",
        "fanLevel": "high"
      },
      "changedProperties": [
        "on"
      ],
      "id": "jm7XebmfVc",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "usMX7gqBpx",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "cBMSgvGde7",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "BkLdbxAeeG",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "mvzQxgcncH",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "JzQtf2NLk9",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "yY6Mn7X68E",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [
        "on"
      ],
      "id": "2FAfTMREmy",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": true,
        "targetTemperature": 27,
        "temperatureUnit": "C",
        "mode": "heat",
        "fanLevel": "high"
      },
      "changedProperties": [
        "on"
      ],
      "id": "NuyTjRVpPq",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [
        "on"
      ],
      "id": "L4JoSJhDb4",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": true,
        "targetTemperature": 27,
        "temperatureUnit": "C",
        "mode": "heat",
        "fanLevel": "high"
      },
      "changedProperties": [
        "on"
      ],
      "id": "pf3piA35U2",
      "failureReason": null
    },
    {
      "status": "Success",
      "reason": "UserRequest",
      "acState": {
        "on": false,
        "fanLevel": "high",
        "temperatureUnit": "C",
        "targetTemperature": 27,
        "mode": "heat",
        "swing": "rangeFull"
      },
      "changedProperties": [],
      "id": "mf7D3Y7VXp",
      "failureReason": null
    }
  ]
}
Yes, it has been working on this system until the botched upgrade. At least, I thought that the botched update was the reason.

I quickly set it up on my system and it produces the same error, so it hasn't got anything to do with the botched upgrade. I run Domoticz 11836 with dzVents 3.0.1 on Buster. The curl command produces exactly the same output.

Has the output from the Sensibo API changed and this output isn't interpreted correctly by the script?

Re: Sensibo through dzVents

Posted: Saturday 18 April 2020 18:17
by waaren
Thelion wrote: Saturday 18 April 2020 17:51 The when using the curl command "curl https://home.sensibo.com/api/v2/pods/xx ... xxxxxxxxxx" from the command-line, it produces:
If this is the exact curl command you use it will send an HTTP get request and in the dzVents script you coded an HTTP post request.
Any reason for this ?

Re: Sensibo through dzVents

Posted: Saturday 18 April 2020 18:31
by Thelion
waaren wrote: Saturday 18 April 2020 18:17
Thelion wrote: Saturday 18 April 2020 17:51 The when using the curl command "curl https://home.sensibo.com/api/v2/pods/xx ... xxxxxxxxxx" from the command-line, it produces:
If this is the exact curl command you use it will send an HTTP get request and in the dzVents script you coded an HTTP post request.
Any reason for this ?
Erhm. Now I lost you. The scripts, from this thread, constructs the URL, with the deviceID en apiKey (which I omitted here, but if you need it, I'll sent it through PM)

The URL above I constructed from the info in the script, to see what the response, if any, would be.

I haven't thought about the GET or POST, to be honest...

Re: Sensibo through dzVents

Posted: Saturday 18 April 2020 19:24
by waaren
Thelion wrote: Saturday 18 April 2020 18:31 Erhm. Now I lost you. .
What I try to explain is that the http request created by the script is not the same as what you send with the curl.

The curl command equivalent to what the script sends is:

Code: Select all

curl -H "Content-Type"="application/json"  -d '{"acState":{"fanLevel":"High","mode":"Heat","on":false,"targetTemperature":27.0}}'  https://home.sensibo.com/api/v2/pods/xxxxxxxx/acStates?apiKey=xxxxxxxx
So what is the return you see when you send this (with the xxxxx replaced.. :) )

Re: Sensibo through dzVents

Posted: Saturday 18 April 2020 19:54
by Thelion
waaren wrote: Saturday 18 April 2020 19:24
Thelion wrote: Saturday 18 April 2020 18:31 Erhm. Now I lost you. .
What I try to explain is that the http request created by the script is not the same as what you send with the curl.

The curl command equivalent to what the script sends is:

Code: Select all

curl -H "Content-Type"="application/json"  -d '{"acState":{"fanLevel":"High","mode":"Heat","on":false,"targetTemperature":27.0}}'  https://home.sensibo.com/api/v2/pods/xxxxxxxx/acStates?apiKey=xxxxxxxx
So what is the return you see when you send this (with the xxxxx replaced.. :) )
Ah. I understand.

That command reports:

Code: Select all

 <html><head><title>400 InvalidState - Sensibo</title></head><body><h>400 InvalidState</h><p>parameter "acState" is invalid</p><body></html>
Tested it on both systems, both reports the same.

Interesting.

Re: Sensibo through dzVents

Posted: Saturday 18 April 2020 23:24
by waaren
Thelion wrote: Saturday 18 April 2020 19:54

Code: Select all

 <html><head><title>400 InvalidState - Sensibo</title></head><body><h>400 InvalidState</h><p>parameter "acState" is invalid</p><body></html>
According the API documentation, the mode and fanLevel values should be lowerCase so "high" and "heat". I don't know if it makes a difference but it's worth a try.

Re: Sensibo through dzVents

Posted: Sunday 19 April 2020 2:02
by Thelion
waaren wrote: Saturday 18 April 2020 23:24 According the API documentation, the mode and fanLevel values should be lowerCase so "high" and "heat". I don't know if it makes a difference bit it's worth a try.
I think you are on to something. Changed targettemperature and fanlevel to lowercase (high and heat doesn't seem to matter) and that seems to do the trick, error is gone, but will have to do a real-life check tomorrow when the owner of the AC can check if all works as it is supposed to.

Re: Sensibo through dzVents

Posted: Monday 20 April 2020 23:38
by Thelion
Thelion wrote: Sunday 19 April 2020 2:02
waaren wrote: Saturday 18 April 2020 23:24 According the API documentation, the mode and fanLevel values should be lowerCase so "high" and "heat". I don't know if it makes a difference bit it's worth a try.
I think you are on to something. Changed targettemperature and fanlevel to lowercase (high and heat doesn't seem to matter) and that seems to do the trick, error is gone, but will have to do a real-life check tomorrow when the owner of the AC can check if all works as it is supposed to.
It works again! Thanks for the assist waaren. ;-)

Re: Sensibo through dzVents

Posted: Monday 05 October 2020 21:11
by remcod
Problem solved, wrong virtual switch type.