Need help with item binding

Why this not work?

Number tempMax "Temp" {mqtt="<[mosquitto:/sonoffF009/changedummy:state:default]", http=">[*:GET:http://192.168.0.103/control?cmd=event,changedummy=%0$s]", autoupdate="false"}
Setpoint item=tempMax minValue=1 maxValue=28 step=1

From log:

Item 'tempMax' received command 20.0

Is it correct to use %0$s? Why HTTP request is not fire?

Should be %2$s is you are wanting to send the string version of the command. See here.

Same issue with %2$s

Number tempMax "Temp" {mqtt="<[mosquitto:/sonoffF009/changedummy:state:default]", http=">[*:GET:http://192.168.0.103/control?cmd=event,changedummy=%2$s]", autoupdate="false"}

HTTP request is not fire

I cannot see a reason why, upon sending a 20.0 command to the tempMax item, an HTTP GET is not performed to http://192.168.0.103/control?cmd=event,changedummy=20.0. @rlkoshak, does anything look amiss to you, or should an issue be opened here?

Same issue with:

Switch thermostatEnabled "Включен" <fire> {mqtt="<[mosquitto:/sonoffF009/thermostat/enabled:state:MAP(toInt.map)]", exec=">[ON:/home/pi/openhab2_scripts/thermostat.sh enabled 1]", autoupdate="false"}

I’ve created simple EXEC and it’s not fire, but with linux terminal it’s works

Nothing looks wrong to me. I’m thinking something must be broken in making sure both bindings get the command. The Exec test adds more evidence, though there could be a whole lot of other things that could go wrong with Exec.

@paveleremin, when you trigger the switch do you see anything in the log at all from the Exec binding? You will not get an error in the log if the command failed but you should at least get something like "Exec binding executing " if the binding is being triggered.

That will confirm whether the problem is just with the HTTP binding or with the core.

1 Like

With logLevel==INFO I didn’t see anything. Maybe I need set logLevel to DEBUG?

If you saw nothing at all from the Exec binding then this is definitely a bug in the core and an issue should be filed.

The main issue was, that I didn’t installed EXEC binding :blush:

Right now I installed EXEC 1.9 and it’s work with this code in _default.items

Switch thermostatEnabled "Включен" <switch> {
	mqtt="<[mosquitto:/sonoffF009/thermostat/enabled:state:MAP(toInt.map)]",
	exec=">[*:/home/pi/openhab2_scripts/thermostat.sh enabled %2$s]",
	autoupdate="false"
}

@rlkoshak @watou what I must to change to migrate this item to EXEC 2.0?

I’m try do the next:

_default.things
Thing exec:thermostat:enabled [command="/home/pi/openhab2_scripts/thermostat.sh enabled %2$s", timeout=2]

_default.items
Switch thermostatEnabled "Включен" <switch> {
	mqtt="<[mosquitto:/sonoffF009/thermostat/enabled:state:MAP(toInt.map)]",
	channel="exec:thermostat:enabled:run",
	autoupdate="false"
}

But it’s not work for me :frowning2: Also I try to change exec:thermostat:enabled to exec:command:thermostatEnabled in both files and got the same.

The new exec 2.0 binding widths very differently than the 1.9 binding. Three is a recent PR with some improved documentation for how to say it up and use it but personally I would recommend sticking with the 1.9 version for now. At least until the PR with the improved docs makes it into the baseline.

Ok, thanks!

The last question is: is it OK that I used multi lines per one item? I mean:

Switch abcd {
  mqtt="",
  autoupdate=""
}

vs

Switch abcd { mqtt="", autoupdate="" }

What do you think? Do you know how parser works?

Never done it that way but suspect it will work just fine. There is one easy way to find out…