[Web Server] Cannot issue Free format commands

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

Moderator: hvxl

[Web Server] Cannot issue Free format commands

Postby tzieg » Mon Jan 09, 2017 10:53 pm

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
tzieg
Starting Member
Starting Member
 
Posts: 12
Joined: January 2017

Re: [Web Server] Cannot issue Free format commands

Postby hvxl » Tue Jan 10, 2017 9:32 pm

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
hvxl
Senior Member
Senior Member
 
Posts: 1297
Joined: June 2010

Re: [Web Server] Cannot issue Free format commands

Postby tzieg » Wed Jan 11, 2017 12:26 am

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: 12
Joined: January 2017

Re: [Web Server] Cannot issue Free format commands

Postby tzieg » Wed Jan 11, 2017 9:28 pm

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 4466 times
tzieg
Starting Member
Starting Member
 
Posts: 12
Joined: January 2017

Re: [Web Server] Cannot issue Free format commands

Postby hvxl » Fri Jan 13, 2017 10:23 pm

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
hvxl
Senior Member
Senior Member
 
Posts: 1297
Joined: June 2010

Re: [Web Server] Cannot issue Free format commands

Postby tzieg » Sat Jan 14, 2017 12:40 pm

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 158 times
tzieg
Starting Member
Starting Member
 
Posts: 12
Joined: January 2017

Re: [Web Server] Cannot issue Free format commands

Postby hvxl » Sat Jan 14, 2017 1:35 pm

Thanks for the patch. Without it I would probably only have changed one location.
Schelte
hvxl
Senior Member
Senior Member
 
Posts: 1297
Joined: June 2010

Re: [Web Server] Cannot issue Free format commands

Postby tzieg » Wed Jan 01, 2020 12:31 pm

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
tzieg
Starting Member
Starting Member
 
Posts: 12
Joined: January 2017

Re: [Web Server] Cannot issue Free format commands

Postby hvxl » Wed Jan 01, 2020 8:26 pm

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
hvxl
Senior Member
Senior Member
 
Posts: 1297
Joined: June 2010


Return to Opentherm Gateway Forum

Who is online

Users browsing this forum: No registered users and 1 guest