Esempio n. 1
0
# This file is part of pyRFXtrx, a Python library to communicate with
# the RFXtrx family of devices from http://www.rfxcom.com/
# See https://github.com/woudt/pyRFXtrx for the latest version.
#
# Copyright (C) 2012  Edwin Woudt <*****@*****.**>
#
# pyRFXtrx is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyRFXtrx is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with pyRFXtrx.  See the file COPYING.txt in the distribution.
# If not, see <http://www.gnu.org/licenses/>.

from RFXtrx.pyserial import PySerialTransport

transport = PySerialTransport('/dev/cu.usbserial-05VN8GHS', debug=True)
transport.reset()

while True:
    print(transport.receive_blocking())
Esempio n. 2
0
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyRFXtrx is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with pyRFXtrx.  See the file COPYING.txt in the distribution.
# If not, see <http://www.gnu.org/licenses/>.


NOT TESTED


from RFXtrx.pyserial import PySerialTransport
from RFXtrx import LightingDevice
from time import sleep

transport = PySerialTransport('/dev/cu.usbserial-05VN8GHS', debug=True)
transport.reset()

while True:
    event = transport.receive_blocking()
    if isinstance(event.device, LightingDevice):
        sleep(5)
        event.device.send_off(transport)
        ack = transport.receive_blocking()