marcelrv / XiaomiRobotVacuumProtocol

Attempt to describe the Xiaomi Robot Vacuum Protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Xiaomi 1T (STYTJ02ZHM) Vacuum

mattphat opened this issue · comments

commented

Hi, purchased one of the new models of vacuum, I've managed to get the binding to give me a dump out of the test data.

Any way to get this little guy into Openhab?

test-dreame.vacuum.p2041-20210412-125720.txt

You better make this request in the openhab addons repository.
You can rename this to.json(remove the txt) and try it in your OH installation (see binding readme on how to do this). You may need to remove the file that was automatically generated during the testfile creation you attached
dreame.vacuum.p2041-miot.json.txt

commented

Thanks for sending me the json file. It's about here that my knowledge of any of this dries up quickly. I've followed as best as I can the binding information (it assumes a lot, but that's fine - that's the nature of this Openhab stuff) and I can read information from the vacuum, but haven't managed to send it any commands as yet... I'll keep trying - currently it's telling me the total hours, previous clean time etc. And that's all correct, so some of the communication is working.

I could see in the openhab log that it is using the correct json file, so thanks!

Indeed the fact that you can read the information is a very good sign.

wouldbe good to send the debug log so it is clear which properties provide which response (and which don't)
This can be done with log:set debug org.opehab.binding.miio in the console

Note that only channels that are connected will be refreshed.

There is one channel, ( actions I believe is the name) which should be able to trigger the starting/stopping etc
I expect it shows with a dropdown in the UI. I assume that is what you mean by sending commands.
If you mean sending custom miio commands, (in the 'language the device understands) you need to enable the command channel (marked as advanced, so you need to unhide it in the UI).

commented

Thanks!! I'll be a while before I can really debug and have a play (this working from home thing, I actually have to work) - I've scrolled through the JSON file and compared to known working ones and I think it's making sense. Will take a bit of trial and error I'm sure.

One thing you might be able to help with right away tho, is I don't have a drop down list in the UI (looking at PaperUI) for actions, it's just an empty box. And in turn, the status updates from the vacuum are just coming through as numbers - not translating to the phrases in the JSON file.

ie: earlier I set it via the MiHome app to vacuum and this is the type of thing I saw in logs :
miio_basic_bd78f7ff_status changed from 6 to 1 (Charging to Sweeping)
miio_basic_bd78f7ff_charging_state changed from 1 to 2 (charging to not charging)

And the UI displays this:

image

Have I configured something wrong?

No, it is not cuz configured wrong, instead it is because of the version used ( I expect version 2.5.x based on the screenie).
In oh3 the action one will behave differently and gives a dropdown.

Likewise, in OH3 it will do the mapping from value to the labels you see in the json file. (if you want to replecate this in OH2 you maybe can make a mapping in the channel config)

The best way to test this is with OH3.1-SNAPSHOT than you know if it works. If you don't run that yet, maybe you can download one just for the trying... than it is clear what is not updating because of the device not responding or what is not there because of the binding version not supporting the features used in the json file. (note, for OH3.0 most of the channels will work as well)

commented

Thanks for explaining that. I'm behind the times! Sigh. I looked into the transition to v3, and I'd have to edit many of my scripts so I'll be a while.. Thanks, I'm sorry I'm not much more use to confirming this is working with the new vacuum.