From 992bec63accf7a4782fd47bd4f54851747c399ef Mon Sep 17 00:00:00 2001 From: Seb Ruiz Date: Tue, 17 May 2022 11:01:41 +1000 Subject: [PATCH] Remove cruft --- README.md | 15 +-------------- custom_components/bhyve/binary_sensor.py | 18 +++--------------- custom_components/bhyve/config_flow.py | 11 ----------- custom_components/bhyve/sensor.py | 21 --------------------- 4 files changed, 4 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index 492164f..adbcdaf 100644 --- a/README.md +++ b/README.md @@ -40,20 +40,7 @@ Recommended installation is via HACS. ## Configuration -```yaml -bhyve: - username: !secret bhyve_username - password: !secret bhyve_password - -sensor: - - platform: bhyve - -switch: - - platform: bhyve - -binary_sensor: - - platform: bhyve -``` +This integration should be configured from the Home Assistant devices & services UI page. ## Sensor Entities diff --git a/custom_components/bhyve/binary_sensor.py b/custom_components/bhyve/binary_sensor.py index 561fcb8..67d0d21 100644 --- a/custom_components/bhyve/binary_sensor.py +++ b/custom_components/bhyve/binary_sensor.py @@ -32,19 +32,6 @@ async def async_setup_entry( async_add_entities(sensors, True) -# async def async_setup_platform(hass, config, async_add_entities, _discovery_info=None): -# """Set up BHyve sensors based on a config entry.""" -# bhyve = hass.data[DATA_BHYVE] - -# sensors = [] -# devices = await bhyve.devices -# for device in devices: -# if device.get("type") == DEVICE_FLOOD: -# sensors.append(BHyveFloodSensor(hass, bhyve, device)) - -# async_add_entities(sensors, True) - - class BHyveFloodSensor(BHyveDeviceEntity): """Define a BHyve sensor.""" @@ -70,11 +57,12 @@ def _setup(self, device): ) def _parse_status(self, status): + """Convert BHyve alarm status to entity value.""" return "on" if status.get("flood_alarm_status") == "alarm" else "off" @property def state(self): - """Return the state of the entity""" + """Return the state of the entity.""" return self._state @property @@ -84,7 +72,7 @@ def unique_id(self): @property def is_on(self): - """Reports state of the flood sensor""" + """Reports state of the flood sensor.""" return self._state == "on" def _on_ws_data(self, data): diff --git a/custom_components/bhyve/config_flow.py b/custom_components/bhyve/config_flow.py index 945234d..394825f 100644 --- a/custom_components/bhyve/config_flow.py +++ b/custom_components/bhyve/config_flow.py @@ -67,17 +67,6 @@ async def async_step_user( self.devices = await self.client.devices # type: ignore[union-attr] self.programs = await self.client.timer_programs # type: ignore[union-attr] - if len(self.devices) == 1: - return self.async_create_entry( - title=self.data[CONF_USERNAME], - data=self.data, - options={ - DEVICES: [str(self.devices[0]["id"])], - PROGRAMS: self.programs, - }, - ) - - # Account has more than one device, select devices to add return await self.async_step_device() return self.async_show_form( diff --git a/custom_components/bhyve/sensor.py b/custom_components/bhyve/sensor.py index ae25b2a..b315a3f 100644 --- a/custom_components/bhyve/sensor.py +++ b/custom_components/bhyve/sensor.py @@ -63,27 +63,6 @@ async def async_setup_entry( async_add_entities(sensors) -# async def async_setup_platform(hass, config, async_add_entities, _discovery_info=None): -# """Set up BHyve sensors based on a config entry.""" -# bhyve = hass.data[DATA_BHYVE] - -# sensors = [] -# devices = await bhyve.devices -# for device in devices: -# if device.get("type") == DEVICE_SPRINKLER: -# sensors.append(BHyveStateSensor(hass, bhyve, device)) -# for zone in device.get("zones"): -# sensors.append(BHyveZoneHistorySensor(hass, bhyve, device, zone)) - -# if device.get("battery", None) is not None: -# sensors.append(BHyveBatterySensor(hass, bhyve, device)) -# if device.get("type") == DEVICE_FLOOD: -# sensors.append(BHyveTemperatureSensor(hass, bhyve, device)) -# sensors.append(BHyveBatterySensor(hass, bhyve, device)) - -# async_add_entities(sensors, True) - - class BHyveBatterySensor(BHyveDeviceEntity): """Define a BHyve sensor."""