Hi there!
I'm at the point of buying a new house, and would like to install a home automation system. I have seen the Bwired site and systems, ans would like to build something similar, but a tad smaller.
The idea is to mainly use X10 over powerline to do the switching, and use a ADC<>RS232 board for reading temperature sensors, and PIR motion sensors.
For the software I want to write my own application in, the age old, Visual Basic 6. I have already made most of the server application, but still would like to find a CM11 VB6 module that uses the MSCOMM. I think I can write it my self, but it will save me tons of work. Does anyone have a sample of code for controlling the CM11 without a ActiveX?!
A screendump of my server application.
The task of the server is to constantly synchronize a INI file with the devices. If the 'change' flag is set for a device in the INI file, the server will notice, and update the state to the device over X10. With this modular system of having a central DB or INI file, I hope to make it easy to implement modules. The module will only have to read the INI for getting the state of the devices, and write a other state to update one.
Anny how, does anyone have some VB6 examples?
Thanks!!
Visual Basic Home Control
-
- Starting Member
- Posts: 3
- Joined: Tue Sep 18, 2012 9:50 am
Re: Visual Basic Home Control
Ok, I have found some crappy code examples.... Not really something to use, but it shows some of the commands that need to be send.
The following was found in the code:
A table I made:
So the following code would translate into the following if I'm correct.
Chr$(&H6) = 0110 << Is 'A' and would be the house code I think
Chr$(&H62)= 0110 << Could be device '1' 0010 << and that would make this the 'on' command
I think I have cracked it!
Question for you guys. If I for example want to send "House A" + "Device 1" + "ON", that would be:
Can I send Chr$(&H6) & Chr$(&H6) & Chr$(&H2) Or do I need to Chr$(&H662), or does is not work either way?
My X10 controller will arrive this week, so I can't test the code just jet.
The following was found in the code:
Code: Select all
sTmp = Chr$(&H4)
m_strInitCode = sTmp & Chr$(&H66)
m_strOnCode = Chr$(&H6) & Chr$(&H62)
m_strOffCode = Chr$(&H6) & Chr$(&H63)
m_strAckCode = Chr$(&H0)
m_strReadyCode = Chr$(&H55)
Code: Select all
'Function Binary Value All Units Off 0000 All Lights On 0001 On 0010 Off 0011 Dim 0100 Bright 0101 All Lights Off 0110 Extended Code 0111 Hail Request 1000 Hail Acknowledge 1001 Pre-set Dim (1) 1010 Pre-set Dim (2) 1011 Extended Data Transfer 1100 Status On 1101 Status Off 1110 Status Request 1111
' Housecode Device Code Binary Value DEC HEX Binary ASCII KEY
' A 1 0000 0110 6 06 0000 0110 ACK Ctrl/F
' B 2 0000 1110 14 0E 0000 1110 SOH Ctrl/N
' C 3 0000 0010 2 02 0000 0010 STX Ctrl/B
' D 4 0000 1010 10 0A 0000 1010 LF Ctrl/J, Line Feed
' E 5 0000 0001 1 01 0000 0001 SOH Ctrl/A
' F 6 0000 1001 9 09 0000 1001 HT Ctrl/I, Tab
' G 7 0000 0101 5 05 0000 0101 ENQ Ctrl/E
' H 8 0000 1101 13 0D 0000 1101 CR Ctrl/M, Return
' I 9 0000 0111 7 07 0000 0111 BEL Ctrl/G
' J 10 0000 1111 15 0F 0000 1111 SI Ctrl/O
' K 11 0000 0011 3 03 0000 0011 ETX Ctrl/C
' L 12 0000 1011 11 0B 0000 1011 VT Ctrl/K
' M 13 0000 0000 0 00 0000 0000 NUL Ctrl/1
' N 14 0000 1000 8 08 0000 1000 BS Ctrl/H, Backspace
' O 15 0000 0100 4 04 0000 0100 EOT Ctrl/D
' P 16 0000 1100 12 0C 0000 1100 FF Ctrl/L
Code: Select all
m_strOnCode = Chr$(&H6) & Chr$(&H62)
Chr$(&H6) = 0110 << Is 'A' and would be the house code I think
Chr$(&H62)= 0110 << Could be device '1' 0010 << and that would make this the 'on' command
I think I have cracked it!
Question for you guys. If I for example want to send "House A" + "Device 1" + "ON", that would be:
Code: Select all
0110 0110 0010
My X10 controller will arrive this week, so I can't test the code just jet.
Re: Visual Basic Home Control
Chr$(&H662) could be something different then Chr$(&H6) & Chr$(&H6) & Chr$(&H2)
Although you use an AND operation to put the three value together i think there needs to be also a seperator between the binary sets to make them distinqued. However i am not sure of that either. Best guess is just wait for your controller and try
Although you use an AND operation to put the three value together i think there needs to be also a seperator between the binary sets to make them distinqued. However i am not sure of that either. Best guess is just wait for your controller and try
Bram
Re: Visual Basic Home Control
Chr$(&H662) does not exist. Character codes range from 0 to 255 (decimal) for this function so it will probably result in a syntax or runtime error or something else you do not want
-
- Starting Member
- Posts: 3
- Joined: Tue Sep 18, 2012 9:50 am
Re: Visual Basic Home Control
Aha, that explains the runtime-error I got. But I will just wait for the controller to arive. Thanks so far for you're help guys!