本文整理汇总了Python中homeassistant.components.cover.mqtt.MqttCover.find_percentage_in_range方法的典型用法代码示例。如果您正苦于以下问题:Python MqttCover.find_percentage_in_range方法的具体用法?Python MqttCover.find_percentage_in_range怎么用?Python MqttCover.find_percentage_in_range使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类homeassistant.components.cover.mqtt.MqttCover
的用法示例。
在下文中一共展示了MqttCover.find_percentage_in_range方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_find_percentage_in_range_altered_inverted
# 需要导入模块: from homeassistant.components.cover.mqtt import MqttCover [as 别名]
# 或者: from homeassistant.components.cover.mqtt.MqttCover import find_percentage_in_range [as 别名]
def test_find_percentage_in_range_altered_inverted(self):
"""Test find percentage in range with altered range and inverted."""
mqtt_cover = MqttCover(
name='cover.test',
state_topic='state-topic',
get_position_topic=None,
command_topic='command-topic',
availability_topic=None,
tilt_command_topic='tilt-command-topic',
tilt_status_topic='tilt-status-topic',
qos=0,
retain=False,
state_open='OPEN', state_closed='CLOSE',
position_open=80, position_closed=180,
payload_open='OPEN', payload_close='CLOSE', payload_stop='STOP',
payload_available=None, payload_not_available=None,
optimistic=False, value_template=None,
tilt_open_position=180, tilt_closed_position=80,
tilt_min=80, tilt_max=180, tilt_optimistic=False,
tilt_invert=True,
set_position_topic=None, set_position_template=None,
unique_id=None, device_config=None, discovery_hash=None)
assert 60 == mqtt_cover.find_percentage_in_range(120)
assert 60 == mqtt_cover.find_percentage_in_range(120, 'cover')
示例2: test_find_percentage_in_range_altered_inverted
# 需要导入模块: from homeassistant.components.cover.mqtt import MqttCover [as 别名]
# 或者: from homeassistant.components.cover.mqtt.MqttCover import find_percentage_in_range [as 别名]
def test_find_percentage_in_range_altered_inverted(self):
"""Test find percentage in range with altered range and inverted."""
mqtt_cover = MqttCover(
'cover.test', 'foo', 'bar', 'fooBar', "fooBarBaz", 0, False,
'OPEN', 'CLOSE', 'OPEN', 'CLOSE', 'STOP', False, None,
180, 80, 80, 180, False, True)
self.assertEqual(60, mqtt_cover.find_percentage_in_range(120))
示例3: test_find_percentage_in_range_defaults_inverted
# 需要导入模块: from homeassistant.components.cover.mqtt import MqttCover [as 别名]
# 或者: from homeassistant.components.cover.mqtt.MqttCover import find_percentage_in_range [as 别名]
def test_find_percentage_in_range_defaults_inverted(self):
"""Test find percentage in range with default range but inverted."""
mqtt_cover = MqttCover(
'cover.test', 'foo', 'bar', 'fooBar', "fooBarBaz", 0, False,
'OPEN', 'CLOSE', 'OPEN', 'CLOSE', 'STOP', False, None,
100, 0, 0, 100, False, True)
self.assertEqual(56, mqtt_cover.find_percentage_in_range(44))
示例4: test_find_percentage_in_range_altered_inverted
# 需要导入模块: from homeassistant.components.cover.mqtt import MqttCover [as 别名]
# 或者: from homeassistant.components.cover.mqtt.MqttCover import find_percentage_in_range [as 别名]
def test_find_percentage_in_range_altered_inverted(self):
"""Test find percentage in range with altered range and inverted."""
mqtt_cover = MqttCover(
'cover.test', 'state-topic', 'command-topic', None,
'tilt-command-topic', 'tilt-status-topic', 0, False,
'OPEN', 'CLOSE', 'OPEN', 'CLOSE', 'STOP', None, None,
False, None, 180, 80, 80, 180, False, True, None, None)
self.assertEqual(60, mqtt_cover.find_percentage_in_range(120))
示例5: test_find_percentage_in_range_defaults_inverted
# 需要导入模块: from homeassistant.components.cover.mqtt import MqttCover [as 别名]
# 或者: from homeassistant.components.cover.mqtt.MqttCover import find_percentage_in_range [as 别名]
def test_find_percentage_in_range_defaults_inverted(self):
"""Test find percentage in range with default range but inverted."""
mqtt_cover = MqttCover(
'cover.test', 'state-topic', 'command-topic', None,
'tilt-command-topic', 'tilt-status-topic', 0, False,
'OPEN', 'CLOSE', 'OPEN', 'CLOSE', 'STOP', None, None,
False, None, 100, 0, 0, 100, False, True, None, None)
self.assertEqual(56, mqtt_cover.find_percentage_in_range(44))