reyem / openhab2-addons

Add-ons for openHAB 2.x
Eclipse Public License 2.0
3 stars 1 forks source link

Remotestart-Item from Readme produces syntax error #17

Open redeye86 opened 5 years ago

redeye86 commented 5 years ago

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 commented 5 years ago

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 commented 4 years ago

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

tlanfer commented 4 years ago

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 commented 4 years ago

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

tlanfer commented 4 years ago

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

beinaendi commented 4 years ago

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

tlanfer commented 4 years ago

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

beinaendi commented 4 years ago

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("mail@domain.com", "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