Indicate to user that remote was turned off when call was attempted (#40715)

* Indicate to user that remote was turned off when call was attempted

* Catch exception in test

* Switch to warning log

* Apply suggestions from code review

Add suggested change to loggin
pull/41325/head
Joakim Plate 2020-10-06 06:12:39 +02:00 committed by GitHub
parent acb0307beb
commit 999eeb39b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -243,6 +243,9 @@ class BroadlinkRemote(RemoteEntity, RestoreEntity):
delay = kwargs[ATTR_DELAY_SECS]
if not self._state:
_LOGGER.warning(
"remote.send_command canceled: %s entity is turned off", self.entity_id
)
return
should_delay = False
@ -285,6 +288,9 @@ class BroadlinkRemote(RemoteEntity, RestoreEntity):
toggle = kwargs[ATTR_ALTERNATIVE]
if not self._state:
_LOGGER.warning(
"remote.learn_command canceled: %s entity is turned off", self.entity_id
)
return
should_store = False