本文整理汇总了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")
示例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
示例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)
示例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
示例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)
示例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)
示例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)
示例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
示例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)