Awesome stuff and thank you very much, I think I have just about all I need to start writing up a device handler.
Edit: I had to append to this post as I couldn’t add another post to the same thread…Newby limitation
I have been pulling my hair out with Hubitat and local TCP/UDP comms as there just doesn’t seem to be a great deal of information out there about Hubitat IP comms. Anyway I decided to break away from the Hubitat and just concentrate on working out the communications with the Bonaire Wifi module using Packet Sender. FWIW here is what I have found:
LOCAL DIRECT COMMS
Local IP: 192.168.0.10
MyClimate IP: 192.168.0.11
To establish comms, first you have setup a TCP listener on the Local IP for port 10003 (i.e. TCP 192.168.0.10:10003). Check your inbound firewall rules.
When the listener is listening, send a UPD packet containing the following to the MyClimate IP on port 10001. Change the IP address below to match your Local IP.
<myclimate><get>discovery</get><ip>192.168.0.10</ip><platform>android</platform><version>1.0.0</version></myclimate>
What I can gather from here is that the MyClimate interface establishes a TCP connection back to your Local IP listener on port 10003.
Importantly this connection should be left open as subsequent communication seems to require this connection remain open. If the connection closes, you’ll will need to perform the discovery again. Also note; the connection will timeout after a period of no activity (no rush though, it’s a minute or two)
From here you should have an open and established connection to the MyClimate WiFi unit to which you can issue commands. See some example commands below.
Of note with this connection established, you can optionally open a second TCP connection to the MyClimate IP on TCP port 10002 where the same commands can be issued. Note that issuing a disconnect as per the example below will close all connections.
To get the current settings of your Bonaire, send the following data over the open connection (i.e. from your listener port 10003 or the optional second connection connected to the MyClimate WiFi on TCP port 10002).
<myclimate><get>getzoneinfo</get><zoneList>1,2</zoneList></myclimate>
The return will be something like this:
<myclimate><post>postzoneinfo</post><system>on</system><type>heat</type><zoneList>Common</zoneList><mode>program</mode><setPoint>22</setPoint><roomTemp id="Common">22</roomTemp></myclimate>
To change the settings of your Bonaire simply resend the same response with your altered settings, but with the roomTemp parameter removed. For example:
Set Temperature to 21
<myclimate><post>postzoneinfo</post><system>on</system><type>heat</type><zoneList>Common</zoneList><mode>program</mode><setPoint>21</setPoint></myclimate>
To Turn On
<myclimate><post>postzoneinfo</post><system>on</system><type>heat</type><zoneList>Common</zoneList><mode>program</mode><setPoint>23</setPoint></myclimate>
To Turn Off
<myclimate><post>postzoneinfo</post><system>off</system><type>heat</type><zoneList>Common</zoneList><mode>program</mode><setPoint>23</setPoint></myclimate>
And so on.
When finished and you wish to disconnect, send the following command:
<myclimate><delete>connection</delete></myclimate>
The TCP connection will drop and you can move on.
CLOUD COMMS AKA MYCLIMATE API
I have also been able to get to the bottom of cloud comms by examining packets using a MIM approach. As a result I have been able to successfully reissue commands via the MyClimate API using curl.
The basic steps are as follows.
- Set a lock
- Get status (optional)
- Send an instruction or series of instructions
- Delete lock.
Example commands:
Set Lock
curl -H "X-Authentication-Key: 12345678901234567890123456789012" -H "User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.0.2; SM-P900 Build/LRX22G)" -H "Connection: Keep-Alive" -H "Accept-Encoding: gzip" -X GET https://myclimate.bonaire.com.au/Api/Lock
Get Status
curl -H "X-Authentication-Key: 12345678901234567890123456789012" -H "User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.0.2; SM-P900 Build/LRX22G)" -H "Connection: Keep-Alive" -H "Accept-Encoding: gzip" -X GET https://myclimate.bonaire.com.au/Api/State
Change Setting
curl -H "X-Authentication-Key: 12345678901234567890123456789012" -H "User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.0.2; SM-P900 Build/LRX22G)" -H "Connection: Keep-Alive" -H "Accept-Encoding: gzip" -H "Content-Type: application/x-www-form-urlencoded" -X POST -d @C:\Test\Bonaire_POST.txt https://myclimate.bonaire.com.au/Api/Instruction
Example Bonaire_POST.txt Content (as per Change setting above)
Turn On
<myclimate><post>postzoneinfo</post><zoneList>Common</zoneList><system>on</system><type>heat</type><mode>econ</mode><setPoint>15</setPoint><fanSpeed>8</fanSpeed></myclimate>
Turn Off
<myclimate><post>postzoneinfo</post><zoneList>Common</zoneList><system>off</system><type>heat</type><mode>econ</mode><setPoint>15</setPoint><fanSpeed>8</fanSpeed></myclimate>
HEAT MODE
<myclimate><post>postzoneinfo</post><zoneList>Common</zoneList><system>on</system><type>heat</type><mode>thermo</mode><setPoint>15</setPoint><fanSpeed>8</fanSpeed></myclimate>
Change Fan Speed
<myclimate><post>postzoneinfo</post><zoneList>Common</zoneList><system>on</system><type>heat</type><mode>fan</mode><setPoint>15</setPoint><fanSpeed>2</fanSpeed></myclimate>
Set Economy Mode
<myclimate><post>postzoneinfo</post><zoneList>Common</zoneList><system>on</system><type>heat</type><mode>econ</mode><setPoint>15</setPoint><fanSpeed>1</fanSpeed></myclimate>
Set Thermo Mode
<myclimate><post>postzoneinfo</post><zoneList>Common</zoneList><system>on</system><type>heat</type><mode>thermo</mode><setPoint>15</setPoint><fanSpeed>1</fanSpeed></myclimate>
Set Boost Mode
<myclimate><post>postzoneinfo</post><zoneList>Common</zoneList><system>on</system><type>heat</type><mode>thermo</mode><setPoint>15</setPoint><fanSpeed>1</fanSpeed></myclimate>
Set Manual Only Mode
<myclimate><post>postzoneinfo</post><zoneList>Common</zoneList><system>on</system><type>evap</type><mode>manual</mode><setPoint>15</setPoint><fanSpeed>1</fanSpeed></myclimate>
EVAP/COOL MODE
<myclimate><post>postzoneinfo</post><zoneList>Common</zoneList><system>on</system><type>evap</type><mode>manual</mode><setPoint>15</setPoint><fanSpeed>8</fanSpeed></myclimate>
Change Fan Speed
<myclimate><post>postzoneinfo</post><zoneList>Common</zoneList><system>on</system><type>evap</type><mode>manual</mode><setPoint>15</setPoint><fanSpeed>1</fanSpeed></myclimate>
Set Thermo Mode
<myclimate><post>postzoneinfo</post><zoneList>Common</zoneList><system>on</system><type>evap</type><mode>thermo</mode><setPoint>1</setPoint></myclimate>
Set Fan Only Mode
<myclimate><post>postzoneinfo</post><zoneList>Common</zoneList><system>on</system><type>evap</type><mode>fan</mode><setPoint>15</setPoint><fanSpeed>1</fanSpeed></myclimate>
Set Boost Mode
<myclimate><post>postzoneinfo</post><zoneList>Common</zoneList><system>on</system><type>evap</type><mode>boost</mode><setPoint>15</setPoint><fanSpeed>1</fanSpeed></myclimate>
Delete Lock (when finished controlling unit)
curl -H "X-Authentication-Key: 12345678901234567890123456789012" -H "User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.0.2; SM-P900 Build/LRX22G)" -H "Connection: Keep-Alive" -H "Accept-Encoding: gzip" -X DELETE https://myclimate.bonaire.com.au/Api/Lock
Hopefully this is of help. Ohh and if anyone knows much about Hubitat comms, particularly TCP listeners, please feel free to chime in.