@bartsnijder if you’re still interested I can prepare a jar for whatever version OH you’re using. Plenty of stuff works, all read-only for now, so it’s safe to test.
Sorry for the complete lack of response. With a cold summer (airco switched on this week for the first time), my focus was somewhere else. I’m on OH 4.1.3 and I’m always happy to try stuff. Still quite busy with other projects so I’m not sure if I can contribute a lot other than being a debug user for now.
No problem! It’s not yet ready for the real world usage. And I’m perfectly fine on my own (+ forum help, thank you!!).
I’m not sure what are the typical ways of sending jar file… You can get the 4.1.3 version from here. I install it from the OH console. There is no dedicated wodget yet, but it’s planned. No control functions, all read only. It should be safe, but I give no warranty
HI @PrzemoF
I’ve finally got a coding setup backup but looks like you’ve made a lot of progress.
I continued with my generic java “library” for MHI aircon’s. I can receive data and update my aircon object but for some reason my setAirconStat isn’t updating the unit. I’ll keep debugging but just in case it’s useful I’ve got a full Parser porting the python HA addon here:
If you spot why the sending command isn’t working please let me know.
Can you write a 3 line manual how to run it please? My code seems to be fairly stable, but it’s still read only.
I’ll get the github repo readme updated this evening. I’m in a similar situation where I can read the data but not write to the aircon unit. I’ll need to debug with wireshark this evening to see how my commands differ from the app.
In short though:
// Create aircon object
AirCon aircon = new AirCon();
// Set hostname and port.
aircon.sethostname("192.168.0.12");
aircon.setport("51443");
aircon.setDeviceID("e8165615c7d6");
aircon.setOperatorID("openhab");
Then to get aircon data you would send:
try {
// Get initial stats from aircon unit and parse into the aircon object.
aircon.getAirconStats(false);
aircon.printDeviceData(); //for debugging to see aircon data has updated
} catch (Exception e) {
System.out.println(e.toString());
}
See Aircon.java for a full list of attributes you can get/set. I’ve used methods to get/set the attributes just in case the library is ever used in a multithread environment the methods make it somewhat threadsafe.
To write change to the aircon unit you first change the attributes like so:
aircon.setPresetTemp(21);
Then finally the part that’s not working and needs debugging is encoding the command and sending it to the aircon unit. I suspect I’m missing something from the “send” command that’s needed. As the aircon unit replies but it doesnt update the values. So my guess is I’m missing something from the command.
EDIT: I’m not handling the account adding side of things set so that might be it thinking about it
String command = aircon.parser.toBase64();
try {
// sending command to the aircon unit itself
String response = aircon.sendAircoCommand(command);
aircon.parser.translateBytes(response); //eventually this will be hidden in sendAircoCommand function, this just writes the response to the attributes in Aircon Object, for debugging I've done in manually but eventually this will be "automatic" ie handled in sendAircoCommand method.
aircon.printDeviceData(); //to print response from aircon unit
} catch (Exception e) {
System.out.println(e.toString());
}
It was the account not being added. I can update the aircon unit now. I’ll type up how to use the library/tidy up tonight and send over a useful readme once I’m done
Sounds great!
I’m really lost with openhab addon layouts, feels like a maze.
If I can wrap my head around it or if you can translate my library commands/methods then I’m happy to help as much as I can with the addon.
I’ve used:
apache http client
and org.json libraries.
The rest is from java.time and java.util so nothing fancy.
Hi @PrzemoF
I’ve updated the readme now. I’ve had a look at what you’ve done already, slowly getting me head around it. I’m half tempted to just use my java to make a mqtt bridge to save me learning the openhab addon structure. Or see how much gpt can generate for me.
You can have a look at my Intesis Binding, which works very well for Intesis/AirconWithMe adaptors in MHI devices,
@Matt_Jayne I still have no idea how to use it
How do you compile and run it?
Feel free to ignore this question - I’ll be analysing your code soon to get my code fully functional
Hi @PrzemoF
I’ll try add some more detail this evening. I’ve started adding MQTT bridge.
Essentially clone the repo, then build using maven. (I used VS code to code, so I clone the repo then just run and build). I’ll write out detailed explanation.
However you can also just copy the AirCon.java and create objects in java code as described in the readme. Everything (including parser) is included within the one class.
Hi @PrzemoF
I’ve done my best to extend the readme file with some more detail. Hope this helps. I’m still working on it/adding the MQTT bridge so if you do need specific functionality shout i can slot it in.