Skip to content

Commit

Permalink
First PG3 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
jimboca committed Aug 15, 2021
1 parent 07e8d9c commit 841eb30
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 44 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,5 @@ target/

#Project specific
polyinterface
*.zip

7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@

XML_FILES = profile/*/*.xml
NAME = Airscape
XML_FILES = profile/*/*.xml

# sudo apt-get install libxml2-utils libxml2-dev
check:
check:
echo ${XML_FILES}
xmllint --noout ${XML_FILES}


zip:
zip -x@zip_exclude.lst -r ${NAME}.zip *
30 changes: 13 additions & 17 deletions nodes/Airscape2.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,35 @@
class Airscape2(Node):

def __init__(self, controller, primary, address, name, config_data):
super(Airscape2, self).__init__(controller, primary, address, name)
super(Airscape2, self).__init__(controller.poly, primary, address, name)
self.config_data = config_data
self.debug_level = 1
# TODO: Subscribe to let short poll heppen and remove call from controller node
self.do_poll = False # Don't let shortPoll happen during initialiation
self.watching_door = False
self.status = {}
self.driver = {}
controller.poly.subscribe(controller.poly.START, self.handler_start, address)
controller.poly.subscribe(controller.poly.POLL, self.handler_poll)

def start(self):
def handler_start(self):
self.setDriver('GV1', 0)
LOGGER.info(f'config={self.config_data}')
self.host = self.config_data['host']
self.session = pgSession(self,self.name,LOGGER,self.host,debug_level=self.debug_level)
self.query()
self.do_poll = True

def shortPoll(self):
def handler_poll(self, polltype):
if polltype == 'shortPoll':
self.short_poll()
else:
self.long_poll()

def short_poll(self):
LOGGER.debug('...')
if not self.watching_door:
self.poll()

def longPoll(self):
def long_poll(self):
pass

def poll(self):
Expand Down Expand Up @@ -110,22 +116,12 @@ def watch_door(self):
cnt += 1
self.poll()
self.watching_door = False
LOGGER.debug(f"st={status['doorinprocess']}")
LOGGER.debug(f"st={self.status['doorinprocess']}")

def query(self):
self.poll()
self.reportDrivers()

def setDriver(self,driver,value):
self.driver[driver] = value
super(Airscape2, self).setDriver(driver,value)

def getDriver(self,driver):
if driver in self.driver:
return self.driver[driver]
else:
return super(Airscape2, self).getDriver(driver)

def setOnI(self, command):
val = command.get('value')
LOGGER.info(f'val={val}')
Expand Down
19 changes: 2 additions & 17 deletions nodes/Controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,8 @@ def handler_add_node_done(self, node):
LOGGER.debug(f'node added {node}')

def handler_poll(self, polltype):
if polltype == 'shortPoll':
self.short_poll()
else:
self.long_poll()

def short_poll(self):
nodes = self.poly.getNodes()
for node in nodes:
if nodes[node].address != self.address and nodes[node].do_poll:
nodes[node].short_poll()

def long_poll(self):
nodes = self.poly.getNodes()
for node in nodes:
if nodes[node].address != self.address and nodes[node].do_poll:
nodes[node].long_poll()
self.heartbeat()
if polltype == 'longPoll':
self.heartbeat()

def query(self):
self.check_params()
Expand Down
15 changes: 7 additions & 8 deletions server.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
{
"name": "Airscape",
"docs": "https://github.com/jimboca/udi-poly-airscape",
"docs": "https://github.com/UniversalDevicesInc/udi-poly-airscape/blob/master/README.md",
"forum": "https://forum.universal-devices.com/forum/134-polyglot-v2-airscape-nodeserver/",
"type": "python3",
"executable": "airscape-poly.py",
"install": "install.sh",
"install_cloud": "install_cloud.sh",
"description": "Airscape Node Server",
"description": "Airscape Node Server for Polyglot V3",
"notice": "Your disclaimer here",
"shortPoll": "5",
"longPoll": "600",
"profile_version": "3.0.0",
"credits": [
{
"title": "airscape: A NodeServer for Airscape Fan Integration",
"title": "airscape: A UDI Polyglot V3 NodeServer for Airscape Fan Integration",
"author": "JimBoCA",
"version": "2.1.0",
"date": "April 15, 2019",
"source": "https://github.com/jimboca/udi-poly-airscape",
"license": "https://raw.githubusercontent.com/jimboca/udi-poly-airscape/master/LICENSE"
"version": "3.0.0",
"date": "August 14, 2021",
"source": "https://github.com/UniversalDevicesInc/udi-poly-airscape",
"license": "https://raw.githubusercontent.com/UniversalDevicesInc/udi-poly-airscape/master/LICENSE"
}
]
}
6 changes: 6 additions & 0 deletions zip_exclude.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
__pycache__/*
*/__pycache__/*
logs/*
*.pyc
zip_exclude.lst
Airscape.zip

0 comments on commit 841eb30

Please sign in to comment.