Skip to content

Commit

Permalink
Merge pull request #5 from shawngmc/develop
Browse files Browse the repository at this point in the history
0.0.4: Fan and example fixes
  • Loading branch information
shawngmc authored Mar 2, 2024
2 parents a250cca + c8d32ff commit e88bdda
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.0.4
- Fan: Fixed broken value calls
- Example: Disabled 'update' call which was failing

# 0.0.3
- Fixing packaging issue

Expand Down
4 changes: 2 additions & 2 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ async def main():
print(f"Fan comfort breeze: {await fan.get_comfort_breeze()}")

# Force-update a device
await light.update()
await fan.update()
# await light.update()
# await fan.update()

# Turn the devices off
await light.turn_off()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "hubspace-ng"
version = "0.0.3"
version = "0.0.4"
authors = [
{ name="Shawn McNaughton", email="[email protected]" },
]
Expand Down
16 changes: 8 additions & 8 deletions src/hubspaceng/models/devices/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(
super().__init__(device_json, account, state_update)

# Find the power function
power_func_def = self.filter_function_def("power", "category")
power_func_def = self.filter_function_def("power", "category", instance_filter=["fan-power"])
if power_func_def is not None:
self.power = CategoryFunction("Power", self, power_func_def)
self._functions.append(self.power)
Expand All @@ -38,28 +38,28 @@ def __init__(

async def turn_on(self):
"""Turn the fan on"""
await self.set_state(self.power, 'on')
await self.power.set_state('on')

async def turn_off(self):
"""Turn the fan off"""
await self.set_state(self.power, 'off')
await self.power.set_state('off')

async def is_on(self) -> bool:
"""Return whether or not the fan is on"""
return self.get_state(self.power) == 'on'
return self.power.get_state() == 'on'

async def set_comfort_breeze(self, new_comfort_breeze: str):
"""Change breeze mode, the fan speed cycling function"""
await self.set_state(self.comfort_breeze, new_comfort_breeze)
await self.comfort_breeze.set_state(new_comfort_breeze)

async def get_comfort_breeze(self) -> str:
"""Get the status of breeze mode, the fan speed cycling function"""
return self.get_state(self.comfort_breeze)
return self.comfort_breeze.get_state()

async def set_fan_speed(self, new_fan_speed: str):
"""Change the fan speed"""
await self.set_state(self.fan_speed, new_fan_speed)
await self.fan_speed.set_state(new_fan_speed)

async def get_fan_speed(self) -> str:
"""Get the current fan speed"""
return self.get_state(self.fan_speed)
return self.fan_speed.get_state()
1 change: 1 addition & 0 deletions src/hubspaceng/models/devices/lights/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ async def turn_off(self):

async def is_on(self) -> bool:
"""Return whether or not the light is on"""
# import code; code.interact(local=locals())
return self.power.get_state() == 'on'

async def set_brightness(self, new_brightness: int):
Expand Down

0 comments on commit e88bdda

Please sign in to comment.