Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remotestart-Item from Readme produces syntax error #17

Open
redeye86 opened this issue Jun 14, 2019 · 8 comments
Open

Remotestart-Item from Readme produces syntax error #17

redeye86 opened this issue Jun 14, 2019 · 8 comments

Comments

@redeye86
Copy link

Hello,

i installed the robonect binding and copied the configuration from the readme/wiki page (https://www.openhab.org/addons/bindings/robonect/).

Unfortunately
Switch mowerOneHourJob "Start mowing for one hour from now" {channel="robonect:mower:automower:job",remoteStart=REMOTE_1,afterMode=AUTO,duration=60}
gives me this error in openhab.log:

Configuration model 'robonect.items' has errors, therefore ignoring it: [13,121]: mismatched input 'REMOTE_1' expecting RULE_STRING
[13,140]: mismatched input 'AUTO' expecting RULE_STRING
[13,154]: extraneous input '60' expecting RULE_STRING
[14,26]: mismatched input 'Error' expecting '}'
[24,31]: mismatched character '<EOF>' expecting '"'

If i comment that out, everything else (battery status, mode, etc.) works.
Other question: Is it even possible to set the parameters (remotestart, after-mode and duration) dynamically? Either by items or even better by sending a command in a rule?

@reyem
Copy link
Owner

reyem commented Jun 14, 2019

Without trying it myself, I think the documentation is wrong. The message basically tells you that "REMOTE_1", "AUTO" and "60" are expected to be strings and thus the values should be in quotes. The channels should probably look like

Switch mowerOneHourJob "Start mowing for one hour from now" {channel="robonect:mower:automower:job",remoteStart="REMOTE_1",afterMode="AUTO",duration="60"}

If this works, please confirm, so we can fix the documentation.

@beinaendi
Copy link

Hi reyem, it works with values in quotes and I suggested changes of documentation.

@tlanfer
Copy link

tlanfer commented Jul 3, 2020

This actually does not work for me, unfortunately.
I does no longer produce the item syntax error. I think those parameters are completely ignored. I tested it like this:

Switch gd_Robi_StartJob_home "2 Stunden, dann Aus" { channel="robonect:mower:robi:job",remoteStart="REMOTE_1",afterMode="HOME",duration="10" }

When click that switch, whats actaully sent to the mower is a job that takes the configuration from the paper ui. I know that because i set it as 60 minutes there.
Before i set it up in the paper ui, it would not work at all.

@beinaendi
Copy link

Hi tlanfer, just use JSON interface. It's the most convenient way I think.

@tlanfer
Copy link

tlanfer commented Jul 3, 2020

Do you mean to mean use the http binding instead of the robonect binding?

@beinaendi
Copy link

Yes. Check this out and you'll have much more possibilities: https://forum.robonect.de/viewtopic.php?f=10&t=2535

@tlanfer
Copy link

tlanfer commented Jul 3, 2020

I might give it a try. Combine it with mqtt for updates, which i already use anyway for something else

@beinaendi
Copy link

beinaendi commented Jul 4, 2020

If you need any help, let me know. I'm using a rule so I can choose length based on a Number item and include battery level in log message when it should start, because it only starts when battery level is > 95% (I guess). What you need is...
JsonPath
HTTP-Binding

Item:
Number H2_Robonect_SofortStart "Sofort m\u00e4hen" <time> (gH2_Robonect)

Sitemap:
Switch item=H2_Robonect_SofortStart mappings=[0="0", 60="1h", 120="2h", 180="3h", 240="4h"]

Rule:
rule "Automower Start"
when
Item H2_Robonect_SofortStart received command
then
if (receivedCommand > 0)
{
var String url = "http://192.168.0.34/json?user=user&pass=pass&cmd=status"
var int battery = transform("JSONPATH", "$.status.battery", sendHttpGetRequest(url))
url = "http://192.168.0.34/json?user=user&pass=pass&cmd=mode&mode=job&remotestart=2&after=0&duration=" + receivedCommand
var String response = transform("JSONPATH", "$.successful", sendHttpGetRequest(url))
logInfo("H2_Automower_Start.rules", "Automower: Sofortstart aktiviert f\u00fcr " + receivedCommand + " Minuten. Batterie zu " + battery + "% geladen.")
sendNotification("[email protected]", "Automower: Sofortstart aktiviert f\u00fcr " + receivedCommand + " Minuten. Batterie zu " + battery + "% geladen.")
sendLogNotification("Automower: Sofortstart aktiviert f\u00fcr " + receivedCommand + " Minuten. Batterie zu " + battery + "% geladen.")
sendCommand (H2_Robonect_SofortStart, 0)
} // if
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants