Setting Up PLC-BUS Template
From LinuxMCE wiki
Here are the steps to create an PLC-BUS Template. I have copied the wiki page from the Insteon PLM setup page so you should see similarities. This driver is written entirely in Ruby. At the moment this code is undergoing testing in the hope that it will go into a release.
Contents |
Supported Devices
I am using this driver with the PLCBUS-T 1141E which is USB based but as this employs a USB to Serial converter I imagine that it would also work with the Serial port version of the 1141.
Setting up the Template
- Log into the webadmin
- select Interfaces(under Devices using the left hand menu), or by using Wizard>Devices>Interfaces (using the top menu)
- click Add device (loads Pick Device Template popup)
Adding PLC-BUS Manufacturer
- with the Pick Device Template Popup:
- click Add Manufacturer (loads Add Manufacturer popup)
- with the Add Manufacturer popup:
- type 'PLC-BUS' and click Add
- Click Close
- with the Add Manufacturer popup:
Adding a New Template
- press F5 to refresh the page.
- In the Manufacturer field, select 'PLC-BUS'.
- Under Device Category, select 'Lighting Interface < Interfaces'.
- Click Add device Template (popup changes to Add model)
- select the LAST option:
"It's a simple, generic serial device controlled by RS232, Ethernet or USB, which you'll control with Pluto's GSD and embedded Ruby snippets (very easy). Examples: Lighting control, alarm panels, surveillance cameras, thermostats, weather stations, a/v equipment with RS232 ports, etc"
- Type in 'PLCBUS 1141' in the name or model#.
- Click Add
There will not be a confirmation screen, instead the page will be blank
- Close the Add device Template window.
modifying the new Template
- In Webadmin, Select Advanced, Configuration, Device Templates (from the top menu)
- In the Device Template field, select 'PLCBUS 1141'
- click 'Pick Device Template' (loads Edit Device Template Popup)
- NOTE the Template Number! write this down. (it will be needed for Plug N Play)
- Make sure 'Implements DCE' is checked (should be)
- In the Comm Method, select RS232
Adding a Code Group
- Click 'Edit Ruby Codes' ( loads Edit Ruby Codes Popup)
- In the field to the LEFT of 'Create new group', type in 'PLCBUS'
- click 'Create new group'
- If the 'Uses Group/Codeset' does not change to 'PLCBUS', repeat the previous 2 steps again.
- Once the 'Uses Group/Codeset' says 'PLCBUS' Check 'Discoverable Interfaces'
- Check 'Ruby Internal Commands'
- click Update
Adding Ruby Code
- In the #756 Report Child Devices field leave it blank. (no code for now)
- In the #776 Reset field, copy and paste this code:
- In the #760 Send Command to Child field, copy and paste this code:
- In the #788 StatusReport field leave it blank. (no code for now)
- In the #373 Private Method Listing field, copy and paste this code:
- In the #351 Process IDLE field, copy and paste this code:
- In the #350 Process Incoming Data field, copy and paste this code:
- In the #355 Process Initialize field, copy and paste this code:
- In the #384 Process Receive Command for Child field, copy and paste this code:
- In the #356 Process Release, leave it blank. (no code for now)
- Click Update
- Click Close
Adding Device Data
- Press F5 for refresh the 'Edit Device Template' popup
- In the 'Device data' section, in 'Add a New Parameter' select 'COM Port on PC' and click Add.
- in the Comments Field, type
COM Port
- in the Default Value field, type
/dev/ttyS0
- check the 'Required' and 'Allowed to Modify' boxes
- In the 'Device data' section, in 'Add a New Parameter' select 'COM Port BaudRate' and click Add.
- in the Comments Field, type
Baud Rate
- in the Default Value field, type
9600
- check the 'Required' and 'Use Master Device List Defaults' boxes
- In the 'Device data' section, in 'Add a New Parameter' select 'Configuration' and click Add.
- in the Comments Field, type
User Code
- in the Default Value field, type
1
- check the 'Required' and 'Allowed to Modify' boxes
- In the 'Device data' section, in 'Add a New Parameter' select 'Only One Per PC' and click Add.
- in the Comments Field, type
Only One Per PC
- in the Default Value field, type
1
- In the 'Device data' section, in 'Add a New Parameter' select 'Auto-assign to parents room' and click Add.
- in the Comments Field, type
Assign to Parents Room
- in the Default Value field, type
1
Making the Driver Plug & Play
This bit is yet to be done for this driver
Setting up the Generic Serial Device
- on the top, select Wizard, Devices, Generic Serial Devices. You should now see the PLCBUS 1141 device.
- select the room it's in.
- in the Controlled By box, select the linuxMCE machine that you have plugged it into (probably CORE)
- select Update (at the bottom)
- Now, in the COM PORT ON PC, you can select the com port it's on. Note on mine this was not a /dev/tty but was a string starting with pci000
- select Update (at the bottom)
3 phase
- If you are using with three phase it looks as if you need to add a new parameter and change the code appropriately. I have not done this
- so cannot provide much insight.
You are Done!
Next Steps
You will now want to add some devices
Adding Crystal Panel Switch
- on the top, select Wizard, Devices, Generic Serial Devices. You should now see the PLCBUS 1141 device.
- select the Advanced button to bring up the device configuration, you could also navigate to this from the device tree.
- select create child device and enter a description for the device (eg: Hall Lights)
- select pick device template and choose light switch (dimmable) from the device template dropdown, press 'Pick device template'
- Choose the room and entertainment area where the physical device is
- In the device data select the floorplan object from the dropdown
- Enter the device id into the Port/Channel number - this needs to take the format YZ (2 characters) where Y is the House code (A..P) and Z is the Unit Code (1..16)
- select Save
