[Web Server] Cannot issue Free format commands

This Forum is about the Opentherm gateway (OTGW) from Schelte

Moderator: hvxl

Post Reply
tzieg
Starting Member
Starting Member
Posts: 16
Joined: Mon Jan 09, 2017 10:31 pm

[Web Server] Cannot issue Free format commands

Post by tzieg »

Hi,

I'm a OTGW newbee since a few days. otmonitor operates on a rpi3, connection to the gateway is via USB.
Reading the Log or displaying the Graph works gives identical results on both, the native OTGW interface and on the web-frontend.
Using the native OTGW interface, I can issue Free format commands such as PR=B in Section Miscellaneous which returns the build date of the firmware.
Via the web-frontend, this does not work, there is just no reaction.
Did I forget to set a specific option?

Thanks,
Thomas
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: [Web Server] Cannot issue Free format commands

Post by hvxl »

Which browser? It only works with a browser that supports websockets. Most notably that means it won't work with IE before 10. I tested with Firefox.
Schelte
tzieg
Starting Member
Starting Member
Posts: 16
Joined: Mon Jan 09, 2017 10:31 pm

Re: [Web Server] Cannot issue Free format commands

Post by tzieg »

Ahh, yes, I read about browser incompatibilites but forgot to mention, I'm usually using Firefox or Chrome but not IE.

Just double checked:
- Firefox 50.1.0 under OSX El Capitan: no reaction for any command which writes to the server e.g. also switching between Monitor and Gateway mode
- Chrome 54.0.2840.100 under Debian-8: same behavior.

Connected question: should the Message Log in the browser automatically update? I need to actively reload the page via the browser.

Thanks,
Thomas
tzieg
Starting Member
Starting Member
Posts: 16
Joined: Mon Jan 09, 2017 10:31 pm

Re: [Web Server] Cannot issue Free format commands

Post by tzieg »

Hi again,

I tried to use Chrome's Developer Tools to do a trace. Below are the error messages when navigating to Configure->Miscellaneous->Gateway.
I've attached the full contents of the Developer Tools window
Navigated to http://rpi3-wlan:8080/configure.html
Resource interpreted as Stylesheet but transferred with MIME type text/plain: "http://rpi3-wlan:8080/config.css".
Uncaught DOMException: Failed to construct 'WebSocket': The URL 'wsnullstatus.ws?var=cfg' is invalid.(…)
Resource interpreted as Stylesheet but transferred with MIME type text/plain: "http://rpi3-wlan:8080/config.css".
Uncaught DOMException: Failed to construct 'WebSocket': The URL 'wsnullstatus.ws?var=gwmode' is invalid.(…)
Uncaught TypeError: Cannot read property 'readyState' of undefined(…)
Seems, the WebSocket cannot be created. Any idea what goes wrong here?

Thanks,
Thomas
Attachments
OT-2017-01-11.png
OT-2017-01-11.png (137.54 KiB) Viewed 7830 times
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: [Web Server] Cannot issue Free format commands

Post by hvxl »

The 'wsnullstatus.ws?var=cfg' is wrong. That should be 'ws://rpi3-wlan:8080/status.ws?var=cfg', but the regular expression that extracts the host name and port part doesn't handle the '-' in your host name correctly. It should work OK if you use the IP address, or create an alias FQDN that doesn't have a dash.

I'll fix the code.
Schelte
tzieg
Starting Member
Starting Member
Posts: 16
Joined: Mon Jan 09, 2017 10:31 pm

Re: [Web Server] Cannot issue Free format commands

Post by tzieg »

Hi hvxl,

Good catch!
Adding the the dash to the bracket expression of all occurrences of document.URL.match() solved the issue.

I've attached a simple patch.

Thanks,
Thomas
Attachments
patch.zip
This fixes failures if the FQDN contains a dash
(841 Bytes) Downloaded 499 times
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: [Web Server] Cannot issue Free format commands

Post by hvxl »

Thanks for the patch. Without it I would probably only have changed one location.
Schelte
tzieg
Starting Member
Starting Member
Posts: 16
Joined: Mon Jan 09, 2017 10:31 pm

Re: [Web Server] Cannot issue Free format commands

Post by tzieg »

Happy New Year, Schelte,

I just realized, my patch from 2017 did not make it into the official sources. Was there anything wrong with the patch --or suboptimal?

Background:
  • My otgw ran now 3-years without problems with the otmonitor operating on a raspberry. The last days it crashed with a corrupted sdcard --and I did not have a backup :-(.
  • So I had to reproduce the setup using the latest executables from the otgw download page.
  • As my raspberry's hostname did not change --it's still rpi3-wlan.xxx.yyy, I ran into the same issues (dash in hostname leads to errors of the otmonitor web server) as in 2017.
  • I'm glad this forum still has my patch from that time ;-) so the fix was easy.
Seems everything is ok on my side --also a backup this time.

Decide on your own if it makes sense to use the patch --or a better solution.

Have a great year 2020,
Thomas
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: [Web Server] Cannot issue Free format commands

Post by hvxl »

There is absolutely nothing wrong at all with your patch. So it has been included in the code at gihub. But the "latest" executables from the otgw download page are still version 4.3 from April 2016. No major new features have been added that would justify the effort of creating a new version. And people who need one or more of the bug fixes can just use the latest github version.
Schelte
Post Reply

Return to “Opentherm Gateway Forum”