Skip to content

Commit

Permalink
Fixes issue for switch entity index (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
augustas2 authored Jan 13, 2023
1 parent 0e49511 commit 0d5339c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions custom_components/eldes_alarm/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,23 @@ def icon(self):

async def async_turn_on(self):
"""Turn the entity on."""
output = self.data["outputs"][self.entity_index]

await self.client.turn_on_output(
self.imei,
self.entity_index
output['id']
)

self.data["outputs"][self.entity_index]["outputState"] = True
self.async_write_ha_state()

async def async_turn_off(self):
"""Turn the entity off."""
output = self.data["outputs"][self.entity_index]

await self.client.turn_off_output(
self.imei,
self.entity_index
output['id']
)

self.data["outputs"][self.entity_index]["outputState"] = False
Expand Down

0 comments on commit 0d5339c

Please sign in to comment.