Skip to content

Commit

Permalink
chore: fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
sebr committed May 27, 2023
1 parent 808b68e commit affeeaf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
4 changes: 3 additions & 1 deletion custom_components/bhyve/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def __init__(self, hass, bhyve, device):
"""Initialize the sensor."""
name = "{} flood sensor".format(device.get("name"))
_LOGGER.info("Creating flood sensor: %s", name)
super().__init__(hass, bhyve, device, name, "water", BinarySensorDeviceClass.MOISTURE)
super().__init__(
hass, bhyve, device, name, "water", BinarySensorDeviceClass.MOISTURE
)

def _setup(self, device):
self._available = device.get("is_connected", False)
Expand Down
3 changes: 1 addition & 2 deletions custom_components/bhyve/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ async def async_setup_entry(
device_id = device.get("id")
device_by_id[device_id] = device
if device.get("type") == DEVICE_SPRINKLER:

if not device.get("status"):
_LOGGER.warning(
"Unable to configure device %s: the 'status' attribute is missing. Has it been paired with the wifi hub?",
Expand Down Expand Up @@ -280,7 +279,7 @@ async def async_turn_on(self, **kwargs: Any) -> None:
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the switch off."""
await self._set_state(False)

async def start_program(self):
"""Begins running a program."""
program_payload = self._program["program"]
Expand Down
12 changes: 7 additions & 5 deletions debug/debug.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#! /usr/bin/env python3
# Script utility to debug device/program info from logs

import json
Expand All @@ -14,24 +15,25 @@

diagnostics_json = os.path.join(script_dir, folder + "/diagnostics.json")

with open(diagnostics_json) as diagnosticsFile:
with open(diagnostics_json, mode="r", encoding="utf8") as diagnosticsFile:
diagnostics = json.load(diagnosticsFile)
diagnosticsFile.close()

for device in diagnostics.get("data").get("devices"):
if device.get("type") == "bridge":
continue

name = device.get("name")
name = device.get("name", "Unknown Name")
print("")

if device.get("type") == "sprinkler_timer":
zones = device.get("zones")
print(f"{'Sprinkler':>10}: {name}")
print(f"{'Zones':>10}: ({len(zones)})")
print(f"{'Battery':>10}: {device.get('battery').get('percent')}%")
print(f"{'Zones':>10}: {len(zones)}")
for zone in device.get("zones"):
zn = zone.get("name")
print(f"{zn:<12}: {zn}")
zn = zone.get("name", "Unknown Zone")
print(f" - {zn}")

if device.get("type") == "flood_sensor":
print("Flood sensor:")
Expand Down

0 comments on commit affeeaf

Please sign in to comment.