68 219 läst · 113 svar
68k läst
113 svar
Worx Landroid development
What response do you get for the command ?
curl -H "Content-Type: application/x-www-form-urlencoded" -X POST -d 'data=[["settaggi",11,1]]' http://admin:000@1.2.3.4/jsondata.cgi
When I run this, the mower doesn't stop and return home, but the response I get is:
"settaggi":[0,0,0,0,1,1,0,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
which indicates that it ought to be going home (element 15 = 1).
curl -H "Content-Type: application/x-www-form-urlencoded" -X POST -d 'data=[["settaggi",11,1]]' http://admin:000@1.2.3.4/jsondata.cgi
When I run this, the mower doesn't stop and return home, but the response I get is:
"settaggi":[0,0,0,0,1,1,0,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
which indicates that it ought to be going home (element 15 = 1).
Oh, that was actually just I type when I paste the code here and replaced my true pin code with zeroes.
So in the command I sent I had a correct pin. And I got a valid response back from the webserver.
I but my mower doesn't seem to react to my commands, start on 11 and stop and go home on 12.
So in the command I sent I had a correct pin. And I got a valid response back from the webserver.
I but my mower doesn't seem to react to my commands, start on 11 and stop and go home on 12.
Hmm, could be anything, then. Do you use latest mower SW (1.98) ?
Try it via openhab (see https://github.com/openhab/openhab/wiki/Worx-Landroid).
Or do what I did: start wireshark, then access the mower from your web browser and record comms. Repeat with curl and compare to find out the difference.
Try it via openhab (see https://github.com/openhab/openhab/wiki/Worx-Landroid).
Or do what I did: start wireshark, then access the mower from your web browser and record comms. Repeat with curl and compare to find out the difference.
Seems that the Domoticz API may have been broken in the 3.x upgrade. See https://github.com/mjiderhamn/worx-landroid-nodejs/issues/2 and/or https://www.domoticz.com/forum/viewtopic.php?f=6&t=12660 to follow the progress of this issue.Patrik_N skrev:Hello,
I have some trouble with this wonderful script. Running Domoticz on a RPi2.
Hardware is created successfully but the script fails when trying to create a device.
WG796E.1 running software 1.91
Domoticz v3.4834
See log:
pi@raspberrypi:~/worx-landroid-nodejs$ node landroid2domoticz.js
Initializing devices on [länk]
MQTT hardware found in Domoticz
Devices identified: {"Memory Usage":1 ...}
Making sure device exists: Worx Landroid Battery
Device missing, needs to be created: Worx Landroid Battery
Creating device Worx Landroid Battery with type 2
Response to type=createvirtualsensor&idx=0&sensortype=2: {"status":"ERR"}
/home/pi/worx-landroid-nodejs/domoticz.js:246
throw "Error creating sensor '" + name + "': " + response.status;
^
Error creating sensor 'Worx Landroid Battery': ERR
Finally I found what was wrong, when I compared the output in Wireshark I noticed that I had two extra whitespaces in my command in the json, removing those solved the problem.
I've updated the repo at https://github.com/trieb/worx-landroid so now it's possible to control the mower using mqtt
E.g:
<base_topic>/command check
<base_topic>/command start
<base_topic>/command gohome
Status from the mower is sent back as mqtt messages as before.
I've updated the repo at https://github.com/trieb/worx-landroid so now it's possible to control the mower using mqtt
E.g:
<base_topic>/command check
<base_topic>/command start
<base_topic>/command gohome
Status from the mower is sent back as mqtt messages as before.
miktr, your scripts seems really interesting! But please, a litle how-to get things up and running. I have already installed Mosquitto, and is familiar with it. Is it just to start the script "worx-landroid-mqtt.py", and it keeps looping forever? __init__.py seems useless, so is there another bootup-script? In the scripts folder, there is some hard-coded IP-address.to landroid. These files are not used?
//Jocke
//Jocke
Hi!
1) Copy config_default.ini to a config.ini
2) Edit The 'Mqtt'-section of the condig file. Set 'Host' to the ip address where your have mosquitto running. (Could of course be the same computer). You could also change the 'BaseTopic' to be whatever you like. (landroid in my example below)
3) Edit the 'Landroid'-section. Set 'Addr' to point to the address of your mower and change pin.
4) Start script by running:
>> python worx-landroid.mqtt.py
and let it run.
You should now be able to communicate with the mower by sending mqtt-messages like:
landroid/command check (to get the status of the mower)
landroid/command start
landroid/command gohome
Let me know if you have any problems!
(The files in the scripts-folder are just for testing!)
1) Copy config_default.ini to a config.ini
2) Edit The 'Mqtt'-section of the condig file. Set 'Host' to the ip address where your have mosquitto running. (Could of course be the same computer). You could also change the 'BaseTopic' to be whatever you like. (landroid in my example below)
3) Edit the 'Landroid'-section. Set 'Addr' to point to the address of your mower and change pin.
4) Start script by running:
>> python worx-landroid.mqtt.py
and let it run.
You should now be able to communicate with the mower by sending mqtt-messages like:
landroid/command check (to get the status of the mower)
landroid/command start
landroid/command gohome
Let me know if you have any problems!
(The files in the scripts-folder are just for testing!)
Really nice, I did get it to work.
I had to install python-pip first, and git-core to clone the files, but then it worked.
I do have some suggestions on improvements though.
I had to install python-pip first, and git-core to clone the files, but then it worked.
I do have some suggestions on improvements though.
- One topic where you send out current status, as text string. Either current alarm, or Mowing/Charging/Seeking charger.
- Send out messaegs by interval, without need to receive the check command. Say each minute, and add setting in config file to define this.
- MQTT authentication
Redigerat:
Good suggestions, thanks!Jocke-g skrev:Really nice, I did get it to work.
I had to install python-pip first, and git-core to clone the files, but then it worked.
I do have some suggestions on improvements though.
- One topic where you send out current status, as text string. Either current alarm, or Mowing/Charging/Seeking charger.
- Send out messaegs by interval, without need to receive the check command. Say each minute, and add setting in config file to define this.
- MQTT authentication
I've created issues for 2 and 3 and will add the features as soon as I can. For suggestion 1) I need
some more info, I don't really understand how you mean.
2) https://github.com/trieb/worx-landroid/issues/6
3) https://github.com/trieb/worx-landroid/issues/7
Great!
For 1), i mean instead of sending a whole lot of possible statuses as bools, send the current actual status as a text string to <BaseTopic>/state. If the mower is currently mowing, send the text string "Mowing". If it is charging, send "Charging". If there is an alarm, send the alarm text, for example "Blade blocked" if the alarm is blade_blocked. This should both be sent on interval and when received the check command.
For 1), i mean instead of sending a whole lot of possible statuses as bools, send the current actual status as a text string to <BaseTopic>/state. If the mower is currently mowing, send the text string "Mowing". If it is charging, send "Charging". If there is an alarm, send the alarm text, for example "Blade blocked" if the alarm is blade_blocked. This should both be sent on interval and when received the check command.
Ok, now I got it!
https://github.com/trieb/worx-landroid/issues/8
https://github.com/trieb/worx-landroid/issues/8