Robonect binding / Automower WLAN Module

binding
Tags: #<Tag:0x00007fd3128ede78>

(Marco Meyer) #41

Sound great news. However, as the binding is currently reviewed, I will fix the review point to get it to the official OH release first. If I start now implementing new features, the binding will stay SNAPSHOT for ever. But of course I can look into the new API for the future improvements…
Especially the push sounds interesting, but will introduce some questions.

  1. As far as I understand, the OH2 architecture team does for some reason not like if a binding exposes its own HTTP endpoint. But maybe the mower can be configured on what exact URL to call, and with a bit of luck the official REST API would already work!?
  2. Also I read there something about MQTT. That would be probably even a better alternative. And also here the robonect binding is not important anymore, as MQTT should theoretically be generic enough. The drawback is, one needs to setup a mqtt broker to use it.
  3. But what happens if the mower is out of WIFI Range… So far the binding was able to detect this more or less reliably.
  4. Still the binding will be useful to actually send commands to the mower like starting a job.

:slight_smile: don’t you have a running project with these guys? : https://www.robotshop.com/en/robot-snow-blowers.html


(Daniel Malmgren) #42

Yep, getting the current version through the review before starting with any fancy new features sounds like a good idea :slight_smile:

I’m hoping Robonect will be able to call the OH REST API and simply change the status of the proper items by itself that way. Guess that depends on how configurable it is. But if that’s possible I guess much of that communication happens outside of this binding so it wouldn’t need to be affected by it. Unless the binding it self can call the Robonect API to set up the pushing (would probably make like for the user easier). Guess we’ll have to wait and see.

As you say, there will be a problem if the AM gets stuck outside of wifi range. I guess the binding will still need to poll it, just not with the high frequency used today.

Do you think those snow robots really work? With all the snow we’ve got here in Sweden right now I’m very sceptical. And I don’t think my wife would appreciate me putting over 7000 dollars in it anyway :smile:


(Daniel Malmgren) #43

Hi.
Now that the last snow has melted away and the grass has started growing again I thought I should try the latest binding (this one) but I don’t even seem to be able to add my mower Thing with it. When I click the plus in the paperui inbox and choose the Robonect binding I just get an empty view:

What’s this? Is it because I’m on 2.2.0 stable and the binding is for 2.3.0? The log (also in debug mode) doesn’t say anything at all.


(Marco Meyer) #44

Most probably, it is because if the version difference. I had to change some major things, like using annotations for the factory etc., which may just work in 2.3. that would also explain why you do not even see a lig file…

Now that the last snow has melted away
Amazing, we almost hsve summer already :wink:


(Daniel Malmgren) #45

Ok. I guess that means it’s time for me to move on from 2.2.0. I upgraded my Robonect from last years 1.0 preview to the latest beta (3) so I guess I need the latest binding as well. I’ll report back :slight_smile:

And yes, it’s actually kinda summer here as well. Came quite suddenly, last week we still had snow in our garden and now it’s 20 degrees warm…


(Tilman) #46

I’m using the Robonect Binding in the curent Version 2.3.
I have a feature request to this Binding

It would be great to see the status of all 14 timers (status: ON|OFF)
And it would be great to have the possiblility to switch all Times ON | OFF (by the Rule Engine)


(Daniel Malmgren) #47

Just for the record, this works after I upgraded to snapshot. I’ve got v1.0 beta 3 running on the AM and now everything works like a charm (I’m just using few channels though haven’t tried the rest). Thanks for good work!

Oh. Just because I was so happy, now I discovered something extremely annoying. It seems that in the last betas of Robonect, the AM beeps every time the binding poll it. So once every minut it makes this annoying “bipp bipp” sound. I guess that’s the same problem that @thokl is mentioning in the github merge ticket. I guess there’s not much the binding can do about this, right?


(Tilman) #48

How can i enable/ disable a reobonect-timer in the openhab-rule-engine?
I’ve tried it with “execute a given script” in the openhab-rule-engine, but without success.

How do i have to scipt this?
http://192.168.xxx.xx/xml?cmd=timer&timer=1&enable=0

Thanks 4 help


(Marco Meyer) #49

I created an issue for this (https://github.com/reyem/openhab2-addons/issues/16) to work on after the binding PR got officially accepted and merged to OH.

In the mean time you may use the HTTP Binding

https://docs.openhab.org/addons/bindings/http1/readme.html

something like:

Switch Timer1{ http=">[ON:POST:[http://192.168.xxx.xxx/cmd=timer&timer=1&enable=1](http://192.168.xxx.xxx/cmd=timer&timer=1&enable=1)] >[OFF:POST:[http://192.168.xxx.xxx/cmd=timer&timer=1&enable=0](http://192.168.xxx.xxx/cmd=timer&timer=1&enable=0)]" }

should do the job. If you enabled Authentication you may have to add the header like described here:

https://docs.openhab.org/addons/bindings/http1/readme.html#authorization-header

Although I’m not sure on how reliable the status is. So to get it more or less reliable you may have to parse the response as well as described here:

https://docs.openhab.org/addons/bindings/http1/readme.html#handling-json

Just as a warning, I haven’t used the http binding. So this is all just theory, but may help in finding a solution for short term :wink:


(Tilman) #50

After some Tests and some Errors i got it running.

Switch Robonect_Timer1 { http=">[ON:POST:http://192.168.xxx.xx/xml?cmd=timer&timer=1&enable=1] >[OFF:POST:http://192.168.xxx.xx/xml?cmd=timer&timer=1&enable=0]" }

Attention on the Blanks! If there is a blank between > and [ it does not work


(Daniel Malmgren) #51

A tiny bit off topic here, but I guess this could interest people hanging in this thread: I haven’t found any documentation of the push service (in Robonect beta) so I’ve been trying on my own. Turns out what you choose in the Robonect settings is just when the call occurs. The call itself is always the same, it takes your url and appends some arguments:

?id=075BCE&name=AM&signal=-65&status=17&stopped=0&duration=0&mode=0&battery=100&hours=1319

I’m mainly interested in the status, ie changing the value of my status item in OH, so I did a little PHP for Robonect to call, which in turn calls the OH API to change the value. Just to get you an idea of how it works :slight_smile:

<?php

$itemname = "Automower_Status";
$status = $_GET["status"];
$url = "http://localhost:8080/rest/items/".$itemname;

$options = array(
    'http' => array(
        'header'  => "Content-type: text/plain",
        'method'  => 'POST',
        'content' => $status
    )
);
$context = stream_context_create($options);
file_get_contents($url, false, $context);

?>


Transforming HTTP calls from external systems to OH Rest API
(Daniel Malmgren) #52

@reyem: I know there was discussion in the PR about how to do the lists in the readme. Seems it didn’t go really well anyway in the end, when I look at https://docs.openhab.org/addons/bindings/robonect/readme.html now I see kinda ugly html code.

And while I’m barking at the readme, my AM 310 isn’t mentioned in the supported mowers. It’s got 1.0 beta4 now, working like a charm :wink:


(Flip) #53

Hello @reyem,

thanks for this great plugin! I am using the current Robonect FW 1.0 beta 5 and Openhab 2.3. The robot is a Gargdena Sileno+ and everything works perfect beside one little thing. When I try to set the mowerMode to “MAN” I receive the following error:

2018-06-26 12:02:13.650 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.robonect.handler.RobonectHandler@303c75e7': No enum constant org.openhab.binding.robonect.internal.model.cmd.ModeCommand.Mode.MAN
java.lang.IllegalArgumentException: No enum constant org.openhab.binding.robonect.internal.model.cmd.ModeCommand.Mode.MAN
        at java.lang.Enum.valueOf(Enum.java:238) [?:?]
        at org.openhab.binding.robonect.internal.model.cmd.ModeCommand$Mode.valueOf(ModeCommand.java:1) [220:org.openhab.binding.robonect:2.3.0]
        at org.openhab.binding.robonect.handler.RobonectHandler.setMowerMode(RobonectHandler.java:193) [220:org.openhab.binding.robonect:2.3.0]
        at org.openhab.binding.robonect.handler.RobonectHandler.sendCommand(RobonectHandler.java:126) [220:org.openhab.binding.robonect:2.3.0]
        at org.openhab.binding.robonect.handler.RobonectHandler.handleCommand(RobonectHandler.java:104) [220:org.openhab.binding.robonect:2.3.0]
        at sun.reflect.GeneratedMethodAccessor77.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [101:org.eclipse.smarthome.core:0.10.0.oh230]
        at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [101:org.eclipse.smarthome.core:0.10.0.oh230]
        at com.sun.proxy.$Proxy149.handleCommand(Unknown Source) [220:org.openhab.binding.robonect:2.3.0]
        at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [108:org.eclipse.smarthome.core.thing:0.10.0.oh230]
        at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [108:org.eclipse.smarthome.core.thing:0.10.0.oh230]
        at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [101:org.eclipse.smarthome.core:0.10.0.oh230]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [101:org.eclipse.smarthome.core:0.10.0.oh230]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]

I also tried to set mowerMode to “MANUAL”, it seems the Mode is acceptet but immediately turns back to the state before the change:

2018-06-26 12:04:00.670 [ome.event.ItemCommandEvent] - Item 'mowerMode' received command MANUAL
2018-06-26 12:04:00.683 [vent.ItemStateChangedEvent] - mowerMode changed from HOME to MANUAL
2018-06-26 12:04:00.790 [vent.ItemStateChangedEvent] - mowerDuration changed from 90 to 101
2018-06-26 12:04:00.792 [vent.ItemStateChangedEvent] - robonect_mower_5b61a31e_status_duration changed from 90 s to 101 s
2018-06-26 12:04:00.793 [vent.ItemStateChangedEvent] - mowerMode changed from MANUAL to HOME

All other modes “AUTO”, “HOME” and “EOD” are working perfectly.

Any idea?

Best regards,
Flip


(Marco Meyer) #54

@Flip MANUAL is the proper Mode. MAN will not work as your case shows.

I also tried to set mowerMode to “MANUAL”, it seems the Mode is accepted but immediately turns back to the state before the change:

Did you do this while the mower is in charging station? I did not check, but I think my AM105 does not allow to set MANUAL while it is in the charging station. If you want to let your mower mow the gras in times the timer is inactive, the job command might help.

The Job parameters can be configured using channel configurations. That way you can set up in your OH config some default jobs (like mow now for 60 minutes starting on REMOTE_1 etc.) and configure switches to let the job start.

Unfortunately the documentation is not updated on these last minute refactorings. The examples seem to be wrong in this case and also the MANUAL mode seems to be wrongly documented. I will try to fix them together with the formatting issues @DanielMalmgren mentions.


(Flip) #55

Hi @reyem,

thanks for the quick reply. Yes, I tried to set the mode to “MANUAL” while the mower is in the charging station. But this is like it should be. I don’t know on Automower but as Automower 310 and Gardena Sileno+ are almost identical, the “MANUAL”-mode is used to fully charge the mower. After it has been charged, the mower will leave the charging station as indication that he is ready to place him to a side area. There he will mow until the battery is empty…

Regards,
Flip

PS: If I set the mower to MANUAL-Mode via the Robonect-Webinterface, it works without changing back the mode


(Marco Meyer) #56

:face_with_raised_eyebrow:

I think I found the issue. The latest review points about names in the UI for these modes resulted in a bug as they are translated 1:1. So instead of the correct

http:///json?cmd=mode&mode=MAN

the binding sends now

http:///json?cmd=mode&mode=MANUAL

which is not supported by the API :frowning:

so I create this issue:

for the documentation I created this issue:


(Flip) #57

Hi @reyem

thanks for the quick reply again! So when if I understand correctly, the only thing which need to be changed is to introduce the constant MAN and give it 1:1 to the API?

Best regards,
Flip


(Marco Meyer) #58

more or less correct…

Simply fix the method org.openhab.binding.robonect.internal.model.cmd.ModeCommand#toCommandURL to translate enum org.openhab.binding.robonect.internal.model.cmd.ModeCommand.Mode#MANUAL to “MAN”

When I find some time I can look into the issue and create a PR. Feel free to be faster than me :wink: As it is now in the official OH repo, anybody might create PRs


(Flip) #59

Hi @reyem,

I tried to fix it but I’m not fit in Git and Java. Couldn’t get it to work :frowning:

Regards,
Flip


(Marco Meyer) #60

OK, found finally time to do this small fix. It’s now a PR for OH. This build should already work:

https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.robonect/2.4.0-SNAPSHOT/org.openhab.binding.robonect-2.4.0-SNAPSHOT.jar