[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: 11
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: 1016
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: 11
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 1355 times
tzieg
Starting Member
Starting Member
 
Posts: 11
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: 1016
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 32 times
tzieg
Starting Member
Starting Member
 
Posts: 11
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: 1016
Joined: June 2010


Return to Opentherm Gateway Forum

Who is online

Users browsing this forum: No registered users and 4 guests