Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/insteon/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
_LOGGER.debug(
"Adding device %s entity %s to Binary Sensor platform",
device.address.hex,
device.states[state_key].name,
name,
)

new_entity = InsteonBinarySensor(device, state_key)
Expand Down
9 changes: 3 additions & 6 deletions homeassistant/components/insteon/insteon_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,18 @@ def name(self):
"""Return the name of the node (used for Entity_ID)."""
# Set a base description
description = self._insteon_device.description
if self._insteon_device.description is None:
if description is None:
description = "Unknown Device"

# Get an extension label if there is one
extension = self._get_label()
if extension:
extension = f" {extension}"
name = f"{description} {self._insteon_device.address.human}{extension}"
return name
return f"{description} {self._insteon_device.address.human}{extension}"

@property
def device_state_attributes(self):
"""Provide attributes for display on device card."""
attributes = {"insteon_address": self.address, "insteon_group": self.group}
return attributes
return {"insteon_address": self.address, "insteon_group": self.group}

@callback
def async_entity_update(self, deviceid, group, val):
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/insteon/ipdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ def __len__(self):

def __iter__(self):
"""Itterate through the INSTEON state types to HA platforms."""
for product in self.states:
yield product
yield from self.states

def __getitem__(self, key):
"""Return a Home Assistant platform from an INSTEON state type."""
Expand Down
5 changes: 1 addition & 4 deletions homeassistant/components/insteon/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ def set_default_port(schema: Dict) -> Dict:
if not ip_port:
hub_version = schema.get(CONF_HUB_VERSION)
# Found hub_version but not ip_port
if hub_version == 1:
schema[CONF_IP_PORT] = 9761
else:
schema[CONF_IP_PORT] = 25105
schema[CONF_IP_PORT] = 9761 if hub_version == 1 else 25105
return schema


Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/insteon/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
state_name = device.states[state_key].name

_LOGGER.debug(
"Adding device %s entity %s to Switch platform",
device.address.hex,
device.states[state_key].name,
"Adding device %s entity %s to Switch platform", device.address.hex, state_name,
)

new_entity = None
Expand Down
7 changes: 2 additions & 5 deletions homeassistant/components/insteon/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,9 @@ def _fire_button_on_off_event(address, group, val):
"" if state_name == BUTTON_PRESSED_STATE_NAME else state_name[-1].lower()
)
schema = {CONF_ADDRESS: address.hex}
if button != "":
if button:
schema[EVENT_CONF_BUTTON] = button
if val:
event = EVENT_BUTTON_ON
else:
event = EVENT_BUTTON_OFF
event = EVENT_BUTTON_ON if val else EVENT_BUTTON_OFF
_LOGGER.debug(
"Firing event %s with address %s and button %s", event, address.hex, button
)
Expand Down