First of all, I've learned a lot about domotica/domotiga by reading all the posts at this forum. So thanks to everybody. Now its my time to contribute too with this very long post.
I've managed to add support for the Velleman K8055 board (velleman.eu/distributor/products/view/? ... ;id=351346 into DomotiGa)
To get the K8055 board working in DomotiGa just follow these steps:
1. Install libusb support (sudo apt-get install libusb-dev) as this is required for step 2
2. Install K8055 linux driver/control (follow the instructions @ http://libk8055.sourceforge.net/, make sure you can communicate with the K8055 board using the "k8055" command as this is also used in the DomotiGa code)
3. Add these CASE statements at the specified routines at the FDeviceEditor.class file
RefreshDeviceType()
Code: Select all
CASE "K8055"
cmbInterface.Text = "Velleman K8055"
Code: Select all
CASE "K8055"
lblOther.Text = ("Port")
Code: Select all
CASE 30 ' Velleman Interface
IF Main.bDevicesDebug THEN Main.WriteDebugLog("[Devices] Velleman K8055 board : " & sAddress & " " & sValue)
IF Main.hK8055 THEN
Main.hK8055.SendCommand(sAddress, sValue)
Devices.ValueUpdate(Find(sAddress, iInterface), sValue, "", "", "")
sText = ("Switched ") & sDeviceName & " " & sValue
ELSE
Main.WriteDebugLog(("[Devices] Can't control device '") & sDeviceName & ("' because K8055 is disabled!"))
END IF
Code: Select all
PUBLIC SUB MenuSettingsK8055_Click()
FSettingsK8055.Show
END
@Declarations section:
Code: Select all
' Velleman K8055
PUBLIC bK8055Enabled AS Boolean
PUBLIC sK8055SerialPort AS String
PUBLIC iK8055BoardAddress AS Integer
PUBLIC iK8055PollTime AS Integer
PUBLIC iK8055DebounceTime1 AS Integer
PUBLIC iK8055DebounceTime2 AS Integer
PUBLIC bK8055Debug AS Boolean
PUBLIC hK8055 AS CK8055
Code: Select all
' Velleman K8055
rResult = GetSettingTable("k8055")
bK8055Enabled = rResult!enabled
iK8055BoardAddress = rResult!boardaddress
iK8055PollTime = rResult!polltime
iK8055DebounceTime1 = rResult!debouncetime1
iK8055DebounceTime2 = rResult!debouncetime2
bK8055Debug = rResult!debug
Code: Select all
Setup_K8055() ' Velleman K8055 support
Code: Select all
' k8055 close
TRY hK8055.Disconnect
Code: Select all
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' open Velleman K8055 board and initialize
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PRIVATE SUB Setup_K8055()
IF bK8055Enabled THEN
WriteLog(("Velleman K8055 support enabled."))
IF bServer THEN
' create a new K8055 class instance
hK8055 = NEW CK8055
' set the properties
WITH hK8055
.PollTime = iK8055PollTime
.K8055Debug = bK8055Debug
.AddressBoard = iK8055BoardAddress
.DebounceTime1 = iK8055DebounceTime1
.DebounceTime2 = iK8055DebounceTime2
END WITH
' connect to the serial port
IF hK8055.Connect() THEN
WriteLog(("K8055 interface connected to board address ") & iK8055BoardAddress)
hK8055.Run()
ELSE
WriteLog(("ERROR: K8055 interface FAILED to connect to board address ") & iK8055BoardAddress)
hK8055 = NULL
END IF
END IF
ELSE
WriteLog(("Velleman K8055 support disabled."))
END IF
END
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' restart K8055 after settings change
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PUBLIC SUB Restart_K8055()
IF hK8055 THEN
hK8055.Disconnect
hK8055 = NULL
END IF
Setup_K8055()
END
use these settings:
Name = MenuSettingsK8055
Caption = Velleman K8055
Picture = icons/k8055.png
8. Extract the attached file and add the files to the domotiga folder
9. Add K8055 tables to the domotiga database : mysql -u root -p <k8055.sql
The k8055.sql file is in the attached file.
10. finally compile and run DomotiGa....
@Ron, I hope you have some time to add these changes into the next update of DomotiGa.