Skip to content

Commit

Permalink
Play with ready/rest/ready in rest until I understand it.. bump to 0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
garbled1 committed May 30, 2020
1 parent 2f7793f commit 7d1397c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 8 deletions.
19 changes: 19 additions & 0 deletions pybalboa/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,25 @@ async def mini_engine(spahost):
print("Pump Status: {0}".format(str(spa.pump_status)))
print("Done")

print("Play with heatmode")
print("Heat Mode: {0}".format(spa.get_heatmode(True)))
print("Set to READY")
await spa.change_heatmode(0)
await asyncio.sleep(2)
print("Heat Mode: {0}".format(spa.get_heatmode(True)))
print("Set to REST")
await spa.change_heatmode(2)
await asyncio.sleep(2)
print("Heat Mode: {0}".format(spa.get_heatmode(True)))
print("Set to RNR")
await spa.change_heatmode(1)
await asyncio.sleep(2)
print("Heat Mode: {0}".format(spa.get_heatmode(True)))
print("Set to READY")
await spa.change_heatmode(0)
await asyncio.sleep(2)
print("Heat Mode: {0}".format(spa.get_heatmode(True)))

await spa.disconnect()
return

Expand Down
22 changes: 15 additions & 7 deletions pybalboa/balboa.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,14 +384,22 @@ async def change_heatmode(self, newmode):
data[7] = self.balboa_calc_cs(data[1:], 6)
data[8] = M_END

# You can't put the spa in REST, it can BE in rest, but you cannot
# force it into rest. It's a tri-state, but a binary switch.

# calculate how many times to push the button
for iter in range(1, 2+1):
if newmode == ((self.heatmode + iter) % 3):
break
for pushes in range(1, iter+1):
self.writer.write(data)
await self.writer.drain()
await asyncio.sleep(0.5)
if newmode == self.HEATMODE_READY:
if (self.heatmode == self.HEATMODE_REST or
self.heatmode == self.HEATMODE_RNR):
self.writer.write(data)
await self.writer.drain()
await asyncio.sleep(0.5)

if newmode == self.HEATMODE_REST or newmode == self.HEATMODE_RNR:
if self.heatmode == self.HEATMODE_READY:
self.writer.write(data)
await self.writer.drain()
await asyncio.sleep(0.5)

async def change_temprange(self, newmode):
""" Change the spa's temprange to newmode. """
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def readme():


setup(name='pybalboa',
version='0.9',
version='0.10',
description='Module to communicate with a Balboa spa wifi adapter',
long_description='Module to communicate with a Balboa spa wifi adapter',
url='https://github.com/garbled1/pybalboa',
Expand Down

0 comments on commit 7d1397c

Please sign in to comment.