default.sitemap is …
sitemap default label=“My First Sitemap”
{ Switch item=LightSwitch label=“My light switch” }
services/http.cfg is…
format=false (actally this setting whether true or false makes no difference)
other options are default
Discussion: The Sitemap shows a switch icon with slider button that works. The log file shows switch turning on and off when moving slider button, no errors either. But ESP8255 module does not switch. Furthermore… the ESP8255 does not seem to receive the commands… I say this because the LED is programmed to blink when receiving a command. It blinks with the web browser but not with openHAB when moving the slider button. HELP please.
Oops, I manually transcribed the item and missed the little arrows. I do have the little right arrows… the actual cut and paste follows:
Switch LightSwitch { http= "
services/http.cfg follows ….(other options are default)
format=false
Discussion: The Sitemap shows a switch icon with slider button that works. The log file shows switch turning on and off when moving slider button, no errors either. But ESP8255 module does not switch. Furthermore… the ESP8255 does not seem to receive the commands… I say this because the LED is programmed to blink when receiving a command. It blinks with the web browser but not with openHAB when moving the slider button. HELP please.
I replaced POST with GET and log show errors. anyway… GET did not help. When i enter this simple command in browser http://192.168.1.150:8880/light/on
it switches. All I want is for openHAB to send this simple url
The SSH command line works ( Thank you - great information ) so…now I know the RPI is capable of switching my device and my url syntax http://192.168.1.150:8880/light/on is correct
I tried all of your examples, but none work, I even tried the one with the asterisk and the one with the word CHANGED .
when I do a save, the 9001 Log File gives me the following error
Binding configuration of type 'http' of item 'LightSwitch"' could not be parsed correctly.
' doesn't contain a valid binding configuration
When I programmed the ESP82266, I make the blue on-board LED blink for 2 seconds, indicating a received URL (even a one with an invalid suffix after the :8880, such as:8880/xyz/123 will still blink the LED. Bottom line is that the URL is not being sent from the HTTP binding… but is being properly sent when using SSH command as you suggested.
I have also done a fresh install, down-loaded the SD card image and reinstalled everything.
One thought that came to mind is that the HTTP binding could be expecting the normal http port of :80 whereas I am using :8880. I used 8880 because my ISP may not allow me running a port 80 server. The :8880 works well and allows me to use my router’s IP when away from home.
A guess from me is that it is not meant to define the port.
So the : are recognized as the divider for the postcontent which does not match a valid espression so the last part is taken as contetn for the post message.
Switch httpTest { http=">[*:POST:http://httpbin.org/post:default]"}
Executing url 'http://httpbin.org/post' via method POST, with body content 'ON'
Switch httpTest { http=">[*:POST:http://httpbin.org/post:8088:default]"}
Executing url 'http://httpbin.org/post' via method POST, with body content '8088:default'
As expected it is not designed to take ports.
You might raise an issue in github for the binding.
Try it without the port, one of those.
It’s fixed Thanks to all for the help and the valuable work-arounds and test methods, and especially Dim Angelos who had it right when he asked if I tried it without spaces and all on one line. Apparently I missed a space somewhere when I tried it It’s so difficult to see those spaces. The HTTP binding does not work if an item has is a space after the first quote symbol and the or a line feed between the ON OFF sections… however spaces are optional but not required between the ON OFF sections.
I must have lead myself astray by what I have practiced as good programming form, lining similar things up with spaces and line feeds, but NOT in openHAB. Possibly the HTTP binding is overly restrictive on parsing. I must now assume all parsing is extremely sensitive to spaces in openHAB. Possibly VS has an option to show spaces as little blank squares, that would help.
I removed all spaces EXACTLY like in the HTTP binging examples and put everything on one line. I initially used spaces and spread things out over multiple lines just like I did when I programmed my Arduino devices in C++, for better readability, but openHAB does not tolerate spaces between elements (like a space after an apostrophe) .
Anyway… on the extended port stuff like the http://192.168.1.150:8880/light/on it works great. My application is for a SonOff switch that I re-flashed.
There seems to be a quirk though, with error log reporting when using a POST that has an ON and OFF section. The space as show in the examples, (just before the second right arrow ) separating the ON and OFF sections is required for it to work but not reported as a parsing error if omitted. This gives the illusion that it is OK to omit the space as there is no error reported. Similarly and extra space there (2 spaces) is not reported as an error, but also fails. With good eyesight and if one meticulously follows spacing in the HTTP examples and does not rely on errors log alone, things will be just fine. Beware that one and two spaces can look very similar. It would be nice if VS editor could be configured to show spaces as little blank squares.