Пример #1
0
 def setUp(self):
     self.ms = MockInterface()
     if self.useMock:  # Use Mock Serial Port
         self.upb = UPB(self.ms)
     else:
         self.serial = Serial('/dev/ttyUSB0', 4800)
         self.upb = UPB(self.serial)
Пример #2
0
 def setUp(self):
     self.ms = MockInterface()
     if self.useMock:  # Use Mock Serial Port
         self.sg = Stargate(self.ms)
     else:
         self.serial = Serial('/dev/ttyUSB0', 2400)
         self.sg = Stargate(self.serial)
Пример #3
0
# import the standard python module "select"
import select
import RPi.GPIO as GPIO

# Import all the Pytomation interfaces we are going to use.
from pytomation.interfaces import UPB, InsteonPLM, TCP, Serial, Stargate, W800rf32, NamedPipe, StateInterface, Command, RPIInput, InsteonPLM2, HTTPServer

# Import all the Pytomation Devices we will use.
from pytomation.devices import Motion, Door, Light, Location, InterfaceDevice, Photocell, Generic, StateDevice, State, Attribute, Scene, Controller

#Create PLM and setup Raspberry PI board and web server
#Note: Raspberry PI inputs require root access
insteon = InsteonPLM2(Serial('/dev/ttyUSB0', 19200, xonxoff=False))
GPIO.setmode(GPIO.BOARD)
web = HTTPServer(address='raspberrypi.home')

ph_standard = Location('53.55',
                       '-113.5',
                       tz='Canada/Mountain',
                       mode=Location.MODE.STANDARD,
                       is_dst=True,
                       name='Standard Photocell')

ll_livingroom1 = Light(address='18.97.08',
                       devices=(insteon),
                       name="Living Room Lamp 1")
ll_livingroom2 = Light(address='14.27.D3',
                       devices=(insteon),
                       name="Living Room Lamp 2")

sl_livingroom1 = Light(address='17.F7.8C',
Пример #4
0
import select
import time

from pytomation.interfaces import Serial, W800rf32, InsteonPLM, Wtdio, NamedPipe, \
                                StateInterface, Command, HTTPServer
from pytomation.devices import Motion, Door, Light, Location, InterfaceDevice, Room, \
                                Photocell, Generic, StateDevice, State, Attribute


###################### INTERFACE CONFIG #########################
web = HTTPServer()

insteon = InsteonPLM(Serial('/dev/ttyR2', 19200, xonxoff=False))
wtdio = Wtdio(Serial('/dev/mh_weeder_port', 9600))
w800 = W800rf32(Serial('/dev/mh_w800_port', 4800, xonxoff=False))

# Set the I/O points as inputs on the wtdio board, these are all set as inputs
wtdio.setChannel('ASA')
wtdio.setChannel('ASB')
wtdio.setChannel('ASC')
wtdio.setChannel('ASD')
wtdio.setChannel('ASE')
wtdio.setChannel('ASF')
wtdio.setChannel('ASG')

#wtdio.dio_invert('G')

###################### DEVICE CONFIG #########################

# ______ REMOTES ____________________________________________________
Пример #5
0
# import the standard python modules "select" and "time"
import select
import time

# Import all the Pytomation interfaces we are going to use.
from pytomation.interfaces import InsteonPLM, Serial, HTTP, VenstarThermostat, Command, PytoWebSocketServer, Open_zwave

# Import all the Pytomation Devices we will use.
from pytomation.devices import Attribute, Light, Location, Thermostat, Room, Door, Lock
#from pytomation.devices.scene import Scene

#Web Server
websocket = PytoWebSocketServer()

#Interfaces
insteon = InsteonPLM(Serial('/dev/insteon', 19200, xonxoff=False))
ozw = Open_zwave(serialDevicePath="/dev/zwave", config_path="/etc/openzwave")

#Thermostat (override available commads)
thermostat_commands = [
    Command.AUTOMATIC, Command.COOL, Command.HEAT, Command.HOLD,
    Command.SCHEDULE, Command.OFF, Command.LEVEL, Command.CIRCULATE,
    Command.STILL, Command.VACATE, Command.OCCUPY, Command.SETPOINT
]
hall_thermostat = Thermostat(commands=thermostat_commands,
                             name="Thermostat",
                             devices=VenstarThermostat(
                                 HTTP(host='HallThermostat')))

#Sensors
ph_calculated = Location('38.576492',
Пример #6
0
                                    HTTP, HW_Thermostat, WeMo, InsteonPLM2
from pytomation.devices import Motion, Door, Light, Location, InterfaceDevice, \
                                Photocell, Generic, StateDevice, State, Attribute, \
                                Room, Thermostat, XMPP_Client

#from pytomation.common.system import *

###################### INTERFACE CONFIG #########################
web = HTTPServer()

xmpp = XMPP_Client(id='*****@*****.**',
                   password='******',
                   server='talk.google.com',
                   port=5222)

upb = UPB(Serial('/dev/ttyMI0', 4800))

#insteon = InsteonPLM(TCP('192.168.13.146', 9761))
insteon = InsteonPLM(Serial('/dev/ttyMI1', 19200, xonxoff=False))

w800 = W800rf32(Serial('/dev/ttyMI3', 4800))

sg = Stargate(Serial('/dev/ttyMI4', 9600))
# invert the DIO channels for these contact sensors
sg.dio_invert(1)
sg.dio_invert(2)
sg.dio_invert(3)
sg.dio_invert(4)
sg.dio_invert(5)
sg.dio_invert(6)
sg.dio_invert(7)