How to use set_alarm_state method in localstack

Best Python code snippet using localstack_python

ifttt.py

Source:ifttt.py Github

copy

Full Screen

...108 def alarm_disarm(self, code=None):109 """Send disarm command."""110 if not self._check_code(code):111 return112 self.set_alarm_state(self._event_disarm, STATE_ALARM_DISARMED)113 def alarm_arm_away(self, code=None):114 """Send arm away command."""115 if not self._check_code(code):116 return117 self.set_alarm_state(self._event_away, STATE_ALARM_ARMED_AWAY)118 def alarm_arm_home(self, code=None):119 """Send arm home command."""120 if not self._check_code(code):121 return122 self.set_alarm_state(self._event_home, STATE_ALARM_ARMED_HOME)123 def alarm_arm_night(self, code=None):124 """Send arm night command."""125 if not self._check_code(code):126 return127 self.set_alarm_state(self._event_night, STATE_ALARM_ARMED_NIGHT)128 def set_alarm_state(self, event, state):129 """Call the IFTTT trigger service to change the alarm state."""130 data = {ATTR_EVENT: event}131 self.hass.services.call(IFTTT_DOMAIN, SERVICE_TRIGGER, data)132 _LOGGER.debug("Called IFTTT component to trigger event %s", event)133 if self._optimistic:134 self._state = state135 def push_alarm_state(self, value):136 """Push the alarm state to the given value."""137 if value in ALLOWED_STATES:138 _LOGGER.debug("Pushed the alarm state to %s", value)139 self._state = value140 def _check_code(self, code):...

Full Screen

Full Screen

alarm_control_panel.py

Source:alarm_control_panel.py Github

copy

Full Screen

...68 """Return the list of supported features."""69 return SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | SUPPORT_ALARM_ARM_NIGHT70 async def async_alarm_disarm(self, code=None):71 """Send disarm command."""72 await self.set_alarm_state(STATE_ALARM_DISARMED, code)73 async def async_alarm_arm_away(self, code=None):74 """Send arm command."""75 await self.set_alarm_state(STATE_ALARM_ARMED_AWAY, code)76 async def async_alarm_arm_home(self, code=None):77 """Send stay command."""78 await self.set_alarm_state(STATE_ALARM_ARMED_HOME, code)79 async def async_alarm_arm_night(self, code=None):80 """Send night command."""81 await self.set_alarm_state(STATE_ALARM_ARMED_NIGHT, code)82 async def set_alarm_state(self, state, code=None):83 """Send state command."""84 await self.async_put_characteristics(85 {CharacteristicsTypes.SECURITY_SYSTEM_STATE_TARGET: TARGET_STATE_MAP[state]}86 )87 @property88 def device_state_attributes(self):89 """Return the optional state attributes."""90 attributes = {}91 battery_level = self.service.value(CharacteristicsTypes.BATTERY_LEVEL)92 if battery_level:93 attributes[ATTR_BATTERY_LEVEL] = battery_level...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful