Mercurial > code > home > repos > homeauto
changeset 214:254d656af72e
support a dir of config files
Ignore-this: 729d0aea065af5a0fac6b07653b1d3d2
author | drewp@bigasterisk.com |
---|---|
date | Sun, 03 Jan 2016 02:27:17 -0800 |
parents | 9c8674329a13 |
children | 1e94d074f642 |
files | service/arduinoNode/arduinoNode.py service/arduinoNode/config.n3 service/arduinoNode/config/bang.n3 service/arduinoNode/config/config.n3 service/arduinoNode/config/slash.n3 |
diffstat | 5 files changed, 243 insertions(+), 149 deletions(-) [+] |
line wrap: on
line diff
--- a/service/arduinoNode/arduinoNode.py Sun Jan 03 02:24:27 2016 -0800 +++ b/service/arduinoNode/arduinoNode.py Sun Jan 03 02:27:17 2016 -0800 @@ -40,7 +40,9 @@ def __init__(self): self.graph = Graph() log.info('read config') - self.graph.parse('config.n3', format='n3') + for f in os.listdir('config'): + if f.startswith('.'): continue + self.graph.parse('config/%s' % f, format='n3') self.graph.bind('', ROOM) # not working self.graph.bind('rdf', RDF)
--- a/service/arduinoNode/config.n3 Sun Jan 03 02:24:27 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix : <http://projects.bigasterisk.com/room/> . -@prefix ha: <http://bigasterisk.com/homeauto/> . -@prefix sensor: <http://bigasterisk.com/homeauto/sensor/> . -@prefix houseLoc: <http://bigasterisk.com/homeauto/houseLoc/> . - - -@prefix board0pin: <http://bigasterisk.com/homeauto/board0/pin/> . -@prefix board0ow: <http://bigasterisk.com/homeauto/board0/oneWire/> . - -ha:board0 a :ArduinoBoard; - :device "/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A900cepU-if00-port0"; - :boardTag "atmega328"; - :hasPin - board0pin:d3, - board0pin:d4, - board0pin:d5, - board0pin:d6, - board0pin:d7 . - -board0pin:d3 :pinNumber 3 . -board0pin:d4 :pinNumber 4 . -board0pin:d5 :pinNumber 5 . -board0pin:d6 :pinNumber 6 . -board0pin:d7 :pinNumber 7 . - -board0pin:d3 :connectedTo sensor:motion0 . -sensor:motion0 a :MotionSensor; - :sees houseLoc:storage . - -board0pin:d4 :connectedTo :heater . -:heater a :DigitalOutput . - -board0pin:d5 :connectedTo :storageCeilingLedCross . -:storageCeilingLedCross a :LedOutput . - -board0pin:d6 :connectedTo :storageCeilingLedLong . -:storageCeilingLedLong a :LedOutput . - -board0pin:d7 :connectedTo board0ow: . -board0ow: a :OneWire; - :connectedTo board0ow:temperatureSensor . -board0ow:temperatureSensor a :TemperatureSensor; - :position :storage . - - -@prefix board1pin: <http://bigasterisk.com/homeauto/board1/pin/> . -@prefix board1lcd: <http://bigasterisk.com/homeauto/board1/lcd/> . -@prefix board1ow: <http://bigasterisk.com/homeauto/board1/oneWire/> . - -ha:board1 a :ArduinoBoard; - :device "/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A6004bUG-if00-port0"; - :boardTag "atmega328"; - rdfs:comment "chip has been replaced with a 328"; - :hasPin - board1pin:d3, - board1pin:d5, - board1pin:d6, - board1pin:d7, - board1pin:d8, - board1pin:d9, - board1pin:d10, - board1pin:d11, - board1pin:d12 . - -board1pin:d3 :pinNumber 3 . -board1pin:d10 :pinNumber 10 . -board1pin:d11 :pinNumber 11 . -board1pin:d12 :pinNumber 12 . - -board1pin:d10 :connectedTo board1lcd:backlight . -board1lcd:backlight a :LedOutput, :ActiveLowOutput . - -board1pin:d3 :connectedTo board1ow: . -board1ow: a :OneWire; - :connectedTo board1ow:temperatureSensor . -board1ow:temperatureSensor a :TemperatureSensor; - :position :office . - -board1pin:d9 :pinNumber 9; :connectedTo board1lcd:SID . -board1pin:d8 :pinNumber 8; :connectedTo board1lcd:SCLK . -board1pin:d7 :pinNumber 7; :connectedTo board1lcd:A0 . -board1pin:d6 :pinNumber 6; :connectedTo board1lcd:RST . -board1pin:d5 :pinNumber 5; :connectedTo board1lcd:CS . - -board1lcd: a :ST7565Lcd; - :lcdSID board1lcd:SID; - :lcdSCLK board1lcd:SCLK; - :lcdA0 board1lcd:A0; - :lcdRST board1lcd:RST; - :lcdCS board1lcd:CS . - -@prefix shopPin: <http://bigasterisk.com/homeauto/boardShop/pin/> . -@prefix shopBarcode: <http://bigasterisk.com/homeauto/boardShop/barcode/> . -@prefix shopButtons: <http://bigasterisk.com/homeauto/boardShop/buttons/> . -@prefix shopOw: <http://bigasterisk.com/homeauto/boardShop/oneWire/> . -@prefix shopShift: <http://bigasterisk.com/homeauto/boardShop/shift/> . -@prefix shopPwm: <http://bigasterisk.com/homeauto/boardShop/pwm/> . - -ha:boardShop a :ArduinoBoard; - :device "/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A4001hrf-if00-port0"; - :boardTag "atmega168"; - rdfs:comment "board is like diecimila with atmega168"; - :hasPin - shopPin:d0, shopPin:d1, shopPin:d2, shopPin:d3, shopPin:d4, shopPin:d5, shopPin:d6, shopPin:d7, shopPin:d8, shopPin:d9, shopPin:d10, shopPin:d11, shopPin:d12, shopPin:d13, shopPin:a4, shopPin:a5 . - -shopPin:d0 :pinNumber 0 . -shopPin:d1 :pinNumber 1 . -shopPin:d2 :pinNumber 2; :connectedTo shopBarcode:Txblack . -shopPin:d3 :pinNumber 3; :connectedTo shopBarcode:RxGreen . -shopPin:d4 :pinNumber 4; :connectedTo shopOw: . -shopPin:d5 :pinNumber 5; :connectedTo shopButtons:x . -shopPin:d6 :pinNumber 6; :connectedTo shopButtons:x . -shopPin:d7 :pinNumber 7; :connectedTo shopButtons:x . -shopPin:d8 :pinNumber 8; :connectedTo shopButtons:rot . -shopPin:d9 :pinNumber 9; :connectedTo shopButtons:rot . -shopPin:d10 :pinNumber 10; :connectedTo shopShift:data . -shopPin:d11 :pinNumber 11; :connectedTo shopShift:briteLatch . -shopPin:d12 :pinNumber 12; :connectedTo shopShift:lightClock . -shopPin:d13 :pinNumber 13; :connectedTo shopShift:briteClock . - -shopPin:a4 :pinNumber "a4"; :connectedTo shopPwm:sda . -shopPin:a5 :pinNumber "a5"; :connectedTo shopPwm:scl . - -shopOw: a :OneWire; - :connectedTo shopOw:temperatureSensor . -shopOw:temperatureSensor a :TemperatureSensor; - :position :workshop . - -shopPwm:roomLights a :PwmBoard; - :scl shopPwm:scl; - :sda shopPwm:sda; - :output - [:area shopPwm:sewingLight; :channel 0; :wattage 7], - [:area shopPwm:shopLight0; :channel 1; :wattage 10], - [:area shopPwm:shopLight1; :channel 2; :wattage 10], - [:area shopPwm:ariLight; :channel 3; :wattage 10], - [:area shopPwm:shopLight2; :channel 4; :wattage 10], - [:area shopPwm:shopLight3; :channel 6; :wattage 8] . - -# shiftbrite EI (arduino d12) still needs to be connected to +5 - -#barcode red: +5V -#barcode white: gnd -#SoftwareSerial barcode = SoftwareSerial(/* rx pin, green */ 3, -# /* tx pin, black */ 2, -# /* inverse */ true); -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/arduinoNode/config/bang.n3 Sun Jan 03 02:27:17 2016 -0800 @@ -0,0 +1,87 @@ +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix : <http://projects.bigasterisk.com/room/> . +@prefix ha: <http://bigasterisk.com/homeauto/> . +@prefix sensor: <http://bigasterisk.com/homeauto/sensor/> . +@prefix houseLoc: <http://bigasterisk.com/homeauto/houseLoc/> . + +@prefix board0: <http://bigasterisk.com/homeauto/board0/> . +@prefix board0pin: <http://bigasterisk.com/homeauto/board0/pin/> . +@prefix board0ow: <http://bigasterisk.com/homeauto/board0/oneWire/> . + +ha:board0 a :ArduinoBoard; + :device "/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A900cepU-if00-port0"; + :boardTag "atmega328"; + :hasPin + board0pin:d3, + board0pin:d4, + board0pin:d5, + board0pin:d6, + board0pin:d7, + board0pin:d8 + . + +board0pin:d3 :pinNumber 3 . +board0pin:d4 :pinNumber 4 . +board0pin:d5 :pinNumber 5 . +board0pin:d6 :pinNumber 6 . +board0pin:d7 :pinNumber 7 . +board0pin:d8 :pinNumber 8 . + + +board0pin:d3 :connectedTo sensor:motion0 . +sensor:motion0 a :MotionSensor; + :sees houseLoc:storage . + +board0pin:d4 :connectedTo :heater . +:heater a :DigitalOutput . + +board0pin:d5 :connectedTo :storageCeilingLedCross . +:storageCeilingLedCross a :LedOutput . + +board0pin:d6 :connectedTo :storageCeilingLedLong . +:storageCeilingLedLong a :LedOutput . + +board0pin:d7 :connectedTo board0ow: . +board0ow: a :OneWire; + :connectedTo board0ow:dev-1052790f02080086 . +board0ow:dev-1052790f02080086 a :TemperatureSensor; + :position :storage; + :graphiteName "system.house.temp.storage" . + + +ha:boardTest a :ArduinoBoard; + :device "/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A9YLHR7R-if00-port0"; + :boardTag "nano328"; + :hasPin :bt8 . + +:bt8 :pinNumber 8 . + +board0pin:d8 :connectedTo board0:rgb . +board0:rgb a :RgbPixels; + :pixels ( + board0:rgb_left_top_0 + board0:rgb_left_top_1 + board0:rgb_left_top_2 + board0:rgb_left_bottom_0 + board0:rgb_left_bottom_1 + board0:rgb_left_bottom_2 + board0:rgb_right_top_0 + board0:rgb_right_top_1 + board0:rgb_right_top_2 + board0:rgb_right_bottom_0 + board0:rgb_right_bottom_1 + board0:rgb_right_bottom_2 + ). + +board0:rgb_left_top_0 rdfs:label "rgb_left_top_0" . +board0:rgb_left_top_1 rdfs:label "rgb_left_top_1" . +board0:rgb_left_top_2 rdfs:label "rgb_left_top_2" . +board0:rgb_left_bottom_0 rdfs:label "rgb_left_bottom_0" . +board0:rgb_left_bottom_1 rdfs:label "rgb_left_bottom_1" . +board0:rgb_left_bottom_2 rdfs:label "rgb_left_bottom_2" . +board0:rgb_right_top_0 rdfs:label "rgb_right_top_0" . +board0:rgb_right_top_1 rdfs:label "rgb_right_top_1" . +board0:rgb_right_top_2 rdfs:label "rgb_right_top_2" . +board0:rgb_right_bottom_0 rdfs:label "rgb_right_bottom_0" . +board0:rgb_right_bottom_1 rdfs:label "rgb_right_bottom_1" . +board0:rgb_right_bottom_2 rdfs:label "rgb_right_bottom_2" . \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/arduinoNode/config/config.n3 Sun Jan 03 02:27:17 2016 -0800 @@ -0,0 +1,90 @@ +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix : <http://projects.bigasterisk.com/room/> . +@prefix ha: <http://bigasterisk.com/homeauto/> . +@prefix sensor: <http://bigasterisk.com/homeauto/sensor/> . +@prefix houseLoc: <http://bigasterisk.com/homeauto/houseLoc/> . + + +@prefix board1pin: <http://bigasterisk.com/homeauto/board1/pin/> . +@prefix board1lcd: <http://bigasterisk.com/homeauto/board1/lcd/> . +@prefix board1ow: <http://bigasterisk.com/homeauto/board1/oneWire/> . + +ha:board1 a :ArduinoBoard; + :device "/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A6004bUG-if00-port0"; + :boardTag "atmega328"; + rdfs:comment "chip has been replaced with a 328"; + :hasPin + board1pin:d3, + board1pin:d5, + board1pin:d6, + board1pin:d7, + board1pin:d8, + board1pin:d9, + board1pin:d10, + board1pin:d11, + board1pin:d12 . + +board1pin:d3 :pinNumber 3 . +board1pin:d10 :pinNumber 10 . +board1pin:d11 :pinNumber 11 . +board1pin:d12 :pinNumber 12 . + +board1pin:d10 :connectedTo board1lcd:backlight . +board1lcd:backlight a :LedOutput, :ActiveLowOutput . + +board1pin:d3 :connectedTo board1ow: . +board1ow: a :OneWire; + :connectedTo board1ow:temperatureSensor . +board1ow:temperatureSensor a :TemperatureSensor; + :position :office . + +board1pin:d9 :pinNumber 9; :connectedTo board1lcd:SID . +board1pin:d8 :pinNumber 8; :connectedTo board1lcd:SCLK . +board1pin:d7 :pinNumber 7; :connectedTo board1lcd:A0 . +board1pin:d6 :pinNumber 6; :connectedTo board1lcd:RST . +board1pin:d5 :pinNumber 5; :connectedTo board1lcd:CS . + +board1lcd: a :ST7565Lcd; + :lcdSID board1lcd:SID; + :lcdSCLK board1lcd:SCLK; + :lcdA0 board1lcd:A0; + :lcdRST board1lcd:RST; + :lcdCS board1lcd:CS . + + +@prefix board2pin: <http://bigasterisk.com/homeauto/board2/pin/> . +@prefix board2ow: <http://bigasterisk.com/homeauto/board2/oneWire/> . + +ha:board2 a :ArduinoBoard; + :device "/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A4001nIu-if00-port0"; + :boardTag "diecimila"; + :hasPin + board2pin:d3, + board2pin:d4, + board2pin:d5, + board2pin:d6, + board2pin:d7 + . + +board2pin:d3 :pinNumber 3; :connectedTo sensor:motionAriDesk . +sensor:motionAriDesk a :MotionSensor; + :sees houseLoc:ariDesk . + +board2pin:d4 :pinNumber 4; :connectedTo sensor:buttonAriBed . +sensor:buttonAriBed a :Pushbutton . + +board2pin:d5 :pinNumber 5; :connectedTo board2ow: . + +board2ow: a :OneWire; + :connectedTo board2ow:dev-2813bea50300003d . +board2ow:dev-2813bea50300003d a :TemperatureSensor; + :position houseLoc:ariUnderBed; + :graphiteName "system.house.temp.ariUnderBed" . + +board2pin:d6 :pinNumber 6; :connectedTo :starTrekLight . +:starTrekLight a :LedOutput; + :position houseLoc:ariRoom . + +board2pin:d7 :pinNumber 7; :connectedTo sensor:motionAriBed . +sensor:motionAriBed a :MotionSensor; + :sees houseLoc:ariBed .
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/arduinoNode/config/slash.n3 Sun Jan 03 02:27:17 2016 -0800 @@ -0,0 +1,63 @@ +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix : <http://projects.bigasterisk.com/room/> . +@prefix ha: <http://bigasterisk.com/homeauto/> . +@prefix sensor: <http://bigasterisk.com/homeauto/sensor/> . +@prefix houseLoc: <http://bigasterisk.com/homeauto/houseLoc/> . + + +@prefix shopPin: <http://bigasterisk.com/homeauto/boardShop/pin/> . +@prefix shopBarcode: <http://bigasterisk.com/homeauto/boardShop/barcode/> . +@prefix shopButtons: <http://bigasterisk.com/homeauto/boardShop/buttons/> . +@prefix shopOw: <http://bigasterisk.com/homeauto/boardShop/oneWire/> . +@prefix shopShift: <http://bigasterisk.com/homeauto/boardShop/shift/> . +@prefix shopPwm: <http://bigasterisk.com/homeauto/boardShop/pwm/> . + +ha:boardShop a :ArduinoBoard; + :device "/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A4001hrf-if00-port0"; + :boardTag "atmega168"; + rdfs:comment "board is like diecimila with atmega168"; + :hasPin + shopPin:d0, shopPin:d1, shopPin:d2, shopPin:d3, shopPin:d4, shopPin:d5, shopPin:d6, shopPin:d7, shopPin:d8, shopPin:d9, shopPin:d10, shopPin:d11, shopPin:d12, shopPin:d13, shopPin:a4, shopPin:a5 . + +shopPin:d0 :pinNumber 0 . +shopPin:d1 :pinNumber 1 . +shopPin:d2 :pinNumber 2; :connectedTo shopBarcode:Txblack . +shopPin:d3 :pinNumber 3; :connectedTo shopBarcode:RxGreen . +shopPin:d4 :pinNumber 4; :connectedTo shopOw: . +shopPin:d5 :pinNumber 5; :connectedTo shopButtons:x . +shopPin:d6 :pinNumber 6; :connectedTo shopButtons:x . +shopPin:d7 :pinNumber 7; :connectedTo shopButtons:x . +shopPin:d8 :pinNumber 8; :connectedTo shopButtons:rot . +shopPin:d9 :pinNumber 9; :connectedTo shopButtons:rot . +shopPin:d10 :pinNumber 10; :connectedTo shopShift:data . +shopPin:d11 :pinNumber 11; :connectedTo shopShift:briteLatch . +shopPin:d12 :pinNumber 12; :connectedTo shopShift:lightClock . +shopPin:d13 :pinNumber 13; :connectedTo shopShift:briteClock . + +shopPin:a4 :pinNumber "a4"; :connectedTo shopPwm:sda . +shopPin:a5 :pinNumber "a5"; :connectedTo shopPwm:scl . + +shopOw: a :OneWire; + :connectedTo shopOw:dev-28bf08d101000026 . +shopOw:dev-28bf08d101000026 a :TemperatureSensor; + :position :workshop; + :graphiteName "system.house.temp.workshop" . + +shopPwm:roomLights a :PwmBoard; + :scl shopPwm:scl; + :sda shopPwm:sda; + :output + [:area shopPwm:sewingLight; :channel 0; :wattage 7], + [:area shopPwm:shopLight0; :channel 1; :wattage 10], + [:area shopPwm:shopLight1; :channel 2; :wattage 10], + [:area shopPwm:ariLight; :channel 3; :wattage 10], + [:area shopPwm:shopLight2; :channel 4; :wattage 10], + [:area shopPwm:shopLight3; :channel 6; :wattage 8] . + +# shiftbrite EI (arduino d12) still needs to be connected to +5 + +#barcode red: +5V +#barcode white: gnd +#SoftwareSerial barcode = SoftwareSerial(/* rx pin, green */ 3, +# /* tx pin, black */ 2, +# /* inverse */ true);