Turn you PAC into a webserver

Ok, I’ve been sitting on this for the last couple of years…
Ben posted in the forums a while ago http://www.opto22.com/community/showthread.php?t=38 but i now have a demo version which turns your PAC controller into a mini webserver. I have attached a demo application that will allow data from an Opto22 SNAP-PAC to be displayed in a web browser directly from the controller.
There are some limitations with the implementation (sockets) but for small installations it does work very well delivering data directly from a controller.
Writing data to the controller can be done, if you require this function pls contact sales@22solutions.com.au or check out a demo app at http://22solutions.homeip.net:8080. if asked, the username and password is ‘user’ and ‘22solutions’ respectively.
There is a readme file that details the steps required to get the app working with both pac sim and on a PAC device and some tips n pointers.

The app has been compiled in PAC Control Basic 9.1 and has been tested with FF, IE, Safari.
Have fun… :smiley:


Let me just give this one a bump here! I got tired of potential clients telling me that our competitors solutions offered mobile control where ours didn’t. Nick’s helped me come up with a solution using this “webserver” that we’ve successfully implemented and this stuff is great! We’ve basically created a web interface that serves up statuses, error messages, temperature and other I/O data, and even IP cameras all from the webserver to any mobile device or computer! If you have clients that are looking for mobile monitoring solutions say on an iPhone, Android, Blackberry, iPad, etc., this is definitely worth looking into.

This solution is lightweight and fairly simple to customize and Nick’s been a brilliant help as well! Best of all I’m not having to pay large sums of money to an app programmer for a custom app for a particular device everytime… anyone with some basic HTML skills can pull this off.

Well, Opto22 implemented web functionality about 10 years ago!, but abandoned the idea because Schneider sued Opto22 for Patent Infringement.


I don’t know if patents are still alive or expired!

And 10yrs ago they should have been able to keep it!
i don’t know but did that patent infringement extended to the end-user? Opto22 didn’t create this, it was created using the standard programming tools, with reference to an open protocol by a guy with Opto22 gear. Could have been another type of programmable controller doing exactly the same thing, but i don’t know if there are any other controllers out there capable of being programmed to do such a task.
Everything is on the web these days so why not Opto?? This just gives back something that was wrongly stripped from Opto22 10 years ago.

Viva la Opto22!!

Test bench… meet your new strategy!

Did you started from scratch? some time ago i ported BOA server into a SNAP-ARL-ASDS (yes Opto22 developed a linux based controller, i don’t know what happened with it). I think there are some good open source Web Servers optimized for low resources embedded systems. Mostly are written in C, so there isn’t much problem to port it to OptoScript!

Yeah betomelo
i modeled the code based on a very simple http 1.0 server. it has room to improve, but at the moment its fairly functional.
I don’t really know much about how Opto implemented it back in the day and if you could interface to it. I am aware that there was a linux based controller but never really had the coding skills to look at it (different story now though). is there a place where the BOA server can be viewed?

I guess the best thing is that you can use it with a standard opto control strategy. it will just integrate seamlessly with what you already have. i think there would be a lot of people out there who would like to have a web interface for their opto gear but may not possess the skills to set up LAMP and write php scripts and database transactions etc…it can get pretty heavy.
sure there are limitations but for small installations, its perfect.

I have cleaned up some code from the original demo version of the webserver and added a new chart that will update dyndns with your public IP. This way if you have a controller on a domain that has a dynamic IP address (and no way of updating dyndns), you can have the chart run around every so often and do the update for you. The version has been compiled in PAC Basic 9.1 and requires fw version 9.1d (or which ever version gave us the HttpGet command) to run the dns update.
I thought this may add to the fun…:cool:


Thank You Nick. We have a lot of customers who ask about this topic.

Hi Nick,

Well done with your solution. I think that many will enjoy having a webserver on opto22.
I’ve been trying to run your demo on my pc, but I can’t manage to make it work.
Everything seems to be running correctly, but I always get a blank page (the only other response I managed to get is a 404 error, a couple of times).
I had to change the port from 8080 to 8081, because I can’t free the 8080 at the moment. That’s the only change I made.
Also I was wondering if there is any chance to change the path for the html and js.


Likely you’ve covered this, but since you’re using a non-standard port (8081) for HTTP connections on the web server, are you referencing port 8081 in all URLs going to that webserver? e.g. http://mywebserver.com:8081/<path>, etc. Also, I understand that using a dynamic DNS service may affect how ports are referenced.


Thanks David,
the port was not the problem, though. I did manage to make it work, eventually.
I’m using Windows7 64 bit on my pc, and the the filepath where to put the files is C:\Windows\SysWOW64\OptoCom and not C:\Windows\System32\OptoCom as stated in Nick’s readme.txt.


Thanks guys for the input. i will make sure i update the readme to say ‘where ever your OptoCom dir is…’ when (if) i ever update the code. I’m still stuck in the good old days of winxp!! to be honest, didn’t even give another platform a thought…
I hope you found the code useful.


Can you give us an example on how to send command throw this web-server?, like turning something on or of or setting a limit for something?


As per Nicks first post (and I quote);

“Writing data to the controller can be done, if you require this function pls contact sales@22solutions.com.au or check out a demo app at http://22solutions.homeip.net:8080. if asked, the username and password is ‘user’ and ‘22solutions’ respectively.”

Nick has written two way control, but the demo limits you to read only.

Im glad that you guys are finding this useful… Im following with interest as web connectivity is something that Opto is going to offer in the near future I suspect. (Out side of the methods outlined on internetio.com).