当前位置: 首页>>代码示例>>Python>>正文


Python HUB.get_first方法代码示例

本文整理汇总了Python中homeassistant.components.verisure.HUB.get_first方法的典型用法代码示例。如果您正苦于以下问题:Python HUB.get_first方法的具体用法?Python HUB.get_first怎么用?Python HUB.get_first使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在homeassistant.components.verisure.HUB的用法示例。


在下文中一共展示了HUB.get_first方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update

# 需要导入模块: from homeassistant.components.verisure import HUB [as 别名]
# 或者: from homeassistant.components.verisure.HUB import get_first [as 别名]
 def update(self):
     """Update alarm status."""
     hub.update_overview()
     status = hub.get_first("$.armState.statusType")
     if status == 'DISARMED':
         self._state = STATE_ALARM_DISARMED
     elif status == 'ARMED_HOME':
         self._state = STATE_ALARM_ARMED_HOME
     elif status == 'ARMED_AWAY':
         self._state = STATE_ALARM_ARMED_AWAY
     elif status != 'PENDING':
         _LOGGER.error('Unknown alarm state %s', status)
     self._changed_by = hub.get_first("$.armState.name")
开发者ID:BaptisteSim,项目名称:home-assistant,代码行数:15,代码来源:verisure.py

示例2: is_on

# 需要导入模块: from homeassistant.components.verisure import HUB [as 别名]
# 或者: from homeassistant.components.verisure.HUB import get_first [as 别名]
 def is_on(self):
     """Return true if on."""
     if time() - self._change_timestamp < 10:
         return self._state
     self._state = hub.get_first(
         "$.smartPlugs[?(@.deviceLabel == '%s')].currentState",
         self._device_label) == "ON"
     return self._state
开发者ID:EarthlingRich,项目名称:home-assistant,代码行数:10,代码来源:verisure.py

示例3: update

# 需要导入模块: from homeassistant.components.verisure import HUB [as 别名]
# 或者: from homeassistant.components.verisure.HUB import get_first [as 别名]
 def update(self):
     """Update lock status."""
     if time() - self._change_timestamp < 10:
         return
     hub.update_overview()
     status = hub.get_first(
         "$.doorLockStatusList[?(@.deviceLabel=='%s')].lockedState",
         self._device_label)
     if status == 'UNLOCKED':
         self._state = STATE_UNLOCKED
     elif status == 'LOCKED':
         self._state = STATE_LOCKED
     elif status != 'PENDING':
         _LOGGER.error('Unknown lock state %s', status)
     self._changed_by = hub.get_first(
         "$.doorLockStatusList[?(@.deviceLabel=='%s')].userString",
         self._device_label)
开发者ID:arsaboo,项目名称:home-assistant,代码行数:19,代码来源:lock.py

示例4: available

# 需要导入模块: from homeassistant.components.verisure import HUB [as 别名]
# 或者: from homeassistant.components.verisure.HUB import get_first [as 别名]
 def available(self):
     """Return True if entity is available."""
     return hub.get_first(
         "$.smartPlugs[?(@.deviceLabel == '%s')]",
         self._device_label) is not None
开发者ID:EarthlingRich,项目名称:home-assistant,代码行数:7,代码来源:verisure.py

示例5: name

# 需要导入模块: from homeassistant.components.verisure import HUB [as 别名]
# 或者: from homeassistant.components.verisure.HUB import get_first [as 别名]
 def name(self):
     """Return the name or location of the smartplug."""
     return hub.get_first(
         "$.smartPlugs[?(@.deviceLabel == '%s')].area",
         self._device_label)
开发者ID:EarthlingRich,项目名称:home-assistant,代码行数:7,代码来源:verisure.py

示例6: state

# 需要导入模块: from homeassistant.components.verisure import HUB [as 别名]
# 或者: from homeassistant.components.verisure.HUB import get_first [as 别名]
 def state(self):
     """Return the state of the device."""
     return hub.get_first(
         "$.climateValues[?(@.deviceLabel=='%s')].humidity",
         self._device_label)
开发者ID:EarthlingRich,项目名称:home-assistant,代码行数:7,代码来源:verisure.py

示例7: name

# 需要导入模块: from homeassistant.components.verisure import HUB [as 别名]
# 或者: from homeassistant.components.verisure.HUB import get_first [as 别名]
 def name(self):
     """Return the name of this camera."""
     return hub.get_first(
         "$.customerImageCameras[?(@.deviceLabel=='%s')].area",
         self._device_label)
开发者ID:arsaboo,项目名称:home-assistant,代码行数:7,代码来源:camera.py

示例8: available

# 需要导入模块: from homeassistant.components.verisure import HUB [as 别名]
# 或者: from homeassistant.components.verisure.HUB import get_first [as 别名]
 def available(self):
     """Return True if entity is available."""
     return hub.get_first(
         "$.doorLockStatusList[?(@.deviceLabel=='%s')]",
         self._device_label) is not None
开发者ID:arsaboo,项目名称:home-assistant,代码行数:7,代码来源:lock.py

示例9: name

# 需要导入模块: from homeassistant.components.verisure import HUB [as 别名]
# 或者: from homeassistant.components.verisure.HUB import get_first [as 别名]
 def name(self):
     """Return the name of the lock."""
     return hub.get_first(
         "$.doorLockStatusList[?(@.deviceLabel=='%s')].area",
         self._device_label)
开发者ID:arsaboo,项目名称:home-assistant,代码行数:7,代码来源:lock.py


注:本文中的homeassistant.components.verisure.HUB.get_first方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。