Add last triggered to script (#5261)
* Add last triggered to script * Add tests for script last_triggered
This commit is contained in:
parent
82d037a828
commit
467cb18625
3 changed files with 23 additions and 0 deletions
|
@ -31,6 +31,7 @@ CONF_SEQUENCE = "sequence"
|
|||
|
||||
ATTR_VARIABLES = 'variables'
|
||||
ATTR_LAST_ACTION = 'last_action'
|
||||
ATTR_LAST_TRIGGERED = 'last_triggered'
|
||||
ATTR_CAN_CANCEL = 'can_cancel'
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -155,6 +156,7 @@ class ScriptEntity(ToggleEntity):
|
|||
def state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
attrs = {}
|
||||
attrs[ATTR_LAST_TRIGGERED] = self.script.last_triggered
|
||||
if self.script.can_cancel:
|
||||
attrs[ATTR_CAN_CANCEL] = self.script.can_cancel
|
||||
if self.script.last_action:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue