KoKia13/HomeAssistant-Landroid

[FR] Add Start/Stop/Home to Integration

vistalba opened this issue · 6 comments

Hi

I like this very much.
I just miss three more options like "Start", "Stop" and "Home" to controle the mower from HA/NodeRed.

Any plans to integrate them too? As I can see control is just possible with mqtt.
I found this here to communicate with AWS but I don't know how to use it for the worx: https://medium.com/@crhuber/monitoring-plants-with-aws-iot-and-home-assistant-e5aaae42a582

Yes I'll work on these actions.
I was able to push few times to test the RainDelay, with the help of : https://easydomoticz.com/forum/viewtopic.php?t=8246
But it seems I was banned after. Not able to do anything from the official Android app.

Something like:
Stop : mosquitto_pub -d --cert certificate.pem --key key.pem --cafile AmazonRootCA1.pem -h a1optpg91s0ydf-ats.iot.eu-west-1.amazonaws.com -p 8883 -t 'DB505/0023A7E5G3CB/commandIn' -m '{"cmd": 2}' --id android-123456
Start : mosquitto_pub -d --cert certificate.pem --key key.pem --cafile AmazonRootCA1.pem -h a1optpg91s0ydf-ats.iot.eu-west-1.amazonaws.com -p 8883 -t 'DB505/0023A7E5G3CB/commandIn' -m '{"cmd": 1}' --id android-123456
Home : mosquitto_pub -d --cert certificate.pem --key key.pem --cafile AmazonRootCA1.pem -h a1optpg91s0ydf-ats.iot.eu-west-1.amazonaws.com -p 8883 -t 'DB505/0023A7E5G3CB/commandIn' -m '{"cmd": 3}' --id android-123456

I'll try to read and understand the code of the bridge, but this need time.

Nice! I'm happy with it.
Let me know if I can help test some things.
I'm not coder... so for me it's very hard.

Why did you get banned? Do you've tried to much times or did they recognize that it doesn't come from the official App?

Unfortunately the link is in french :(

Few questions about the mosquitto_pub command above:

  • Do we need client certs? Where do we get this?
  • How to find which AWS server is the right one?
  • What valus are this string DB505/0023A7E5G3CB/commandIn?
  • How to find a propper -id value?

They have probably detected that I was using a non official app, tries were with the mosquito_pub command. But it was really few attempts, less than 10.
I was not banned when I was using the bridge...

To get the certs, etc. all is in the French tuto:

#TOKEN=$(curl -v -X POST -d '{"client_id": 1, "grant_type": "password", "scope": "*", "client_secret": "nCH3A0WvMYn66vGorjSrnGZ2YtjQWDiCvjg7jNxK", "username": "<WORX LOGIN>", "password":"<WORX PASSWORD>"}' -H 'Content-Type: application/json' https://api.worxlandroid.com/api/v2/oauth/token | jq -r '.access_token')
#curl -X GET -H 'Accept: application/json' -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" https://api.worxlandroid.com/api/v2/users/certificate | jq -r '.pkcs12' | base64 --decode > certif.p12
#openssl pkcs12 -in certif.p12 -nocerts -nodes -out key.pem
#curl -O https://www.amazontrust.com/repository/AmazonRootCA1.pem
#curl -X GET -H 'Accept: application/json' -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" https://api.worxlandroid.com/api/v2/product-items | jq ".[] | {id: .id, command_in: .mqtt_topics }"
#####  Previous provide parameter like : -t 'DB505/0023A7E5G3CB to be adapted to the next action commands:
Start mower:
#mosquitto_pub -d --cert certificate.pem --key key.pem --cafile AmazonRootCA1.pem -h a1optpg91s0ydf-ats.iot.eu-west-1.amazonaws.com -p 8883 -t 'DB505/0023A7E5G3CB/commandIn' -m '{"cmd": 1}' --id android-12345

etc.

I want to confirm parameters:

  • "client_secret": "nCH3A0WvMYn66vGorjSrnGZ2YtjQWDiCvjg7jNxK"
  • a1optpg91s0ydf-ats.iot.eu-west-1.amazonaws.com
  • --id android-12345

From an official app, to not be banned again. Or how it's managed in the bridge code.

Ok I will try but I think client_secret should be a personal thing too...?

Yes certainly the guy is sharing the command like that. just need to find which hash it is.

I found this one... https://github.com/EishaV/Desktop-App/blob/master/DesktopApp/App.config

This is using same client_secret as well. But may the code of the app will you help too.