![]() |
|
|||||||
| The C-Bus Community Forums is place where C-Bus users can share information and help others with C-Bus. From time to time you will see Clipsal staff on the forums, but this is not an official support channel. If you really need help contact the official support services of Clipsal. More information about the purpose of this forum is available here. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
Here's something I hope people will find useful.
I did most of this nearly 6 months ago when I was off work for a week with the swine flu... too sick to go to work but not sick enough not to be bored out of my mind doing nothing.... so call me a geek. It started out as a project to talk to a weather station like one of these. ..but then I wanted to share the info I'd got from it with other devices, and after a brief conversation with matty, we worked out we could implement a basic web server in logic too. I've been running this code in my own installation for a few months now... I've set up a proxy in my "proper" webserver to forward requests for the weather station to the Colour Touchscreen and it's been working reliably (my friends who live nearby use it regularly to check how much rainfall we've had). The attached project is not very pretty, but the logic code has plenty of examples of how to tackle various problems, and the webserver is kind of cool (IMHO).. and I think it's a good example of how powerful the logic engine really is (thanks darren!). Next is to make it tweet with weather observations... but that might have to wait until the next flu season... Feel free to use this as you like.. any questions, comments, etc welcome. Nick |
|
#2
|
|||
|
|||
|
looks nice to have such kind of a code, thank you!
but what kind of hardware do we use? Wireless Vantage Pro2 and C-Touch through RS232? what kind of web server do you mean?
__________________
http://www.c-bus.ru http://www.clipsal.ru |
|
#3
|
||||
|
||||
|
Quote:
The code I've posted uses serial communications but in reality my project at home uses an old Lantronix UDS10 serial-ethernet converter because the RS232 port on my Colour C-Touch was already used to control my AV receiver.. Changing the code to support this is as simple as changing the intitalisation to "OpenClientSocket" instead of "OpenSerial", and changing all the "ReadSerial" and "WriteSerial" statements to "ReadClientSocket" and "WriteClientSocket". Quote:
In my installation I have a "proper" webserver running (Apache running on an iMac), so I have set up a proxy in that to forward requests for the weather page to the Colour Touchscreen. Nick |
|
#4
|
||||
|
||||
|
Bad form to reply to one's own post I know, but here's a screenshot of the page served up by the Colour Touchscreen :
|
|
#5
|
||||
|
||||
|
I also note that in the screenshot above the weather station is indicating that it's raining... yet the forecast is "Fine"..... we are having some strange weather at the moment here though.
The station is actually usually surprisingly accurate with its forecast of rain, and even snow... It snows quite rarely in the Adelaide Hills.. but the weather station predicted the only snowfall we had last year (I scoffed at the prediction at the time but it proved me wrong). Nick Last edited by NickD; 19 Mar 10 at 03:13 PM. Reason: typo |
|
#6
|
||||
|
||||
|
Keep producing stuff like this Nick and someone is gunna start spiking your drinks with viruses to keep you crook! kudos mate
|
|
#7
|
||||
|
||||
|
With the recent release of PICED 4.8.x, I can now tell you about another cool new feature in logic that I've used in my weather station project.
You can now *send* messages on the C-Bus Measurement application from logic (actually from System IO too). If you look under the Measurement Manager, you'll see a tick box labelled "controllable", as well as some new entries under the "Set IB System IO" menu in the logic wizard. If you tick the "controllable" box on a particular measurement channel in the Measurement Manager, you can specify the units, and you will be able to *Set* this measurement from logic, or from a System IO control. When changed, the new value will be sent on the Measurement application with the units you specified in the Measurement Manager. What this means for the weather station is that I can make the measurements from it available to other C-Bus devices, so another Touchscreen can display them, or a PAC or Wiser could use them in its own logic. In my case the weather station code is running on the Colour C-Touch, and once a minute it broadcasts some of the measurements to the C-Touch Spectrum by the bed. The code to do this is dead simple : Code:
once (Second = 0) then
begin
r_temp := GetRealSystemIO("Daily Rainfall");
SetRealIBSystemIO("Measurement App Real Value", "WIRED", 0, 0, r_temp);
delay(5);
r_temp := GetRealSystemIO("Inside Temperature");
SetRealIBSystemIO("Measurement App Real Value", "WIRED", 0, 3, r_temp);
delay(5);
r_temp := GetRealSystemIO("Outside Temperature");
SetRealIBSystemIO("Measurement App Real Value", "WIRED", 0, 1, r_temp);
delay(5);
r_temp := GetRealSystemIO("Rain Rate");
SetRealIBSystemIO("Measurement App Real Value", "WIRED", 0, 2, r_temp);
end;
You could also use this feature to make measurements from any device with an RS232 or Ethernet interface/protocol available on C-Bus via the Measurement application. Nick Last edited by NickD; 19 Mar 10 at 03:12 PM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|