- Location:
- /trunk
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
/trunk/I_Rain8_1.xml
r1 r3 16 16 function sendCommand(command) 17 17 luup.log("rain8net: sending command: " .. textToHex(tostring(command)) ) 18 if (luup.io.write( command) == false) then18 if (luup.io.write(tostring(command)) == false) then 19 19 luup.log("Cannot send command " .. textToHex(tostring(command)) .. " communications error", 1) 20 20 luup.set_failure(true) 21 21 return false 22 end 23 --TODO: Verify ACK from device? 24 return true 22 25 end 23 --TODO: Verify ACK from device?24 return true25 end26 26 27 function buildCommand( unit, zone, command )28 -- 0x40 [unit] [command | zone]29 return string.char( 0x40, unit, (command + zone) )30 end27 function buildCommand( unit, zone, command ) 28 -- 0x40 [unit] [command | zone] 29 return string.char( 0x40, unit, (command + zone) ) 30 end 31 31 32 function rain8Startup(lul_device)33 luup.log("Running I_Rain8_1.xml")34 -- TODO: Should get poll device for current state?35 end32 function rain8Startup(lul_device) 33 luup.log("Running I_Rain8_1.xml") 34 -- TODO: Should get poll device for current state? 35 end 36 36 </functions> 37 37 … … 47 47 48 48 <action> 49 <serviceId>urn:upnp-org:serviceId: SwitchPower1</serviceId>49 <serviceId>urn:upnp-org:serviceId:Rain8Switch_1</serviceId> 50 50 <name>SetTarget</name> 51 51 <run> 52 52 local power = lul_settings[ 'newTargetValue'] 53 local unit = 1 --luup.variable_get("urn:edmidor-com:serviceId:Rain8_1", "Unit", lul_device)54 local zone = 1 --luup.variable_get("urn:edmidor-com:serviceId:Rain8_1", "Zone", lul_device)53 local unit = luup.variable_get( "urn:upnp-org:serviceId:Rain8Switch_1", "Unit", lul_device ) 54 local zone = luup.variable_get( "urn:upnp-org:serviceId:Rain8Switch_1", "Zone", lul_device ) 55 55 56 56 if( power == "1" ) then … … 61 61 sendCommand( buildCommand(unit, zone, 0x40) ); 62 62 end 63 64 -- Indicate we have run 65 -- TODO: Move to when we have verified valve is on (ACK) 66 luup.variable_set( "urn:upnp-org:serviceId:Rain8Switch_1", "Status", power, lul_device ) 67 63 68 return true 64 69 </run> 65 70 </action> 66 71 72 <action> 73 <serviceId>urn:upnp-org:serviceId:Rain8Switch_1</serviceId> 74 <name>SetAddress</name> 75 <run> 76 luup.log("Rain8: Set address to " .. lul_settings['Unit'] .. ":" .. lul_settings['Zone'] ) 77 luup.variable_set( "urn:upnp-org:serviceId:Rain8Switch_1", "Unit", lul_settings['Unit'], lul_device ) 78 luup.variable_set( "urn:upnp-org:serviceId:Rain8Switch_1", "Zone", lul_settings['Zone'], lul_device ) 79 </run> 80 </action> 81 67 82 </actionList> 68 83 </implementation> -
/trunk/D_Rain8_1.xml
r1 r3 6 6 </specVersion> 7 7 <device> 8 <deviceType>urn:schemas-upnp-org:device: BinaryLight:1</deviceType>9 <staticJson>D_ BinaryLight1.json</staticJson>8 <deviceType>urn:schemas-upnp-org:device:Rain8_1:1</deviceType> 9 <staticJson>D_Rain8_1.json</staticJson> 10 10 <friendlyName>Rain8net Irigation Controller over RS232</friendlyName> 11 11 <manufacturer>WGL Designs</manufacturer> … … 24 24 <serviceList> 25 25 <service> 26 <serviceType>urn:schemas-upnp-org:service: SwitchPower:1</serviceType>27 <serviceId>urn:upnp-org:serviceId: SwitchPower1</serviceId>28 <controlURL>/upnp/control/ SwitchPower1</controlURL>29 <eventSubURL>/upnp/event/ SwitchPower1</eventSubURL>30 <SCPDURL>S_ SwitchPower1.xml</SCPDURL>26 <serviceType>urn:schemas-upnp-org:service:Rain8Switch_1:1</serviceType> 27 <serviceId>urn:upnp-org:serviceId:Rain8Switch_1</serviceId> 28 <controlURL>/upnp/control/Rain8Switch_1</controlURL> 29 <eventSubURL>/upnp/event/Rain8Switch_1</eventSubURL> 30 <SCPDURL>S_Rain8Switch_1.xml</SCPDURL> 31 31 </service> 32 32 </serviceList> 33 33 <sceneList> 34 { 35 "group_1":{ 36 "cmd_1": 37 { 38 "label": "ON", 39 "serviceId": "urn:upnp-org:serviceId:Rain8Switch_1", 40 "action": "SetTarget", 41 "arguments": 42 { 43 "newTargetValue": "1" 44 } 45 }, 46 "cmd_2": 47 { 48 "label": "OFF", 49 "serviceId": "urn:upnp-org:serviceId:Rain8Switch_1", 50 "action": "SetTarget", 51 "arguments": 52 { 53 "newTargetValue": "0" 54 } 55 } 56 } 57 } 58 </sceneList> 59 <eventList> 60 { 61 "event_1":{ 62 "label": "A device is turned on or off", 63 "serviceId": "urn:upnp-org:serviceId:Rain8Switch_1", 64 "argumentList" : 65 { 66 "argument_1" : 67 { 68 "dataType": "boolean", 69 "defaultValue": "1", 70 "allowedValueList" : 71 { 72 "Off" : "0", 73 "On" : "1" 74 }, 75 "name": "Status", 76 "comparisson": "=", 77 "prefix": "Which mode", 78 "suffix": "" 79 } 80 } 81 } 82 } 83 </eventList> 34 84 </device> 35 85 </root>
Note: See TracChangeset
for help on using the changeset viewer.