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


Python mqtt.MqttCover类代码示例

本文整理汇总了Python中homeassistant.components.cover.mqtt.MqttCover的典型用法代码示例。如果您正苦于以下问题:Python MqttCover类的具体用法?Python MqttCover怎么用?Python MqttCover使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test_find_in_range_altered_inverted

    def test_find_in_range_altered_inverted(self):
        """Test find 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 120 == mqtt_cover.find_in_range_from_percent(60)
        assert 120 == mqtt_cover.find_in_range_from_percent(60, 'cover')
开发者ID:ManHammer,项目名称:home-assistant,代码行数:25,代码来源:test_mqtt.py

示例2: test_find_percentage_in_range_defaults

    def test_find_percentage_in_range_defaults(self):
        """Test find percentage in range with default range."""
        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=100,  position_closed=0,
            payload_open='OPEN', payload_close='CLOSE', payload_stop='STOP',
            payload_available=None, payload_not_available=None,
            optimistic=False, value_template=None,
            tilt_open_position=100, tilt_closed_position=0,
            tilt_min=0, tilt_max=100, tilt_optimistic=False,
            tilt_invert=False,
            set_position_topic=None, set_position_template=None,
            unique_id=None, device_config=None, discovery_hash=None)

        assert 44 == mqtt_cover.find_percentage_in_range(44)
        assert 44 == mqtt_cover.find_percentage_in_range(44, 'cover')
开发者ID:ManHammer,项目名称:home-assistant,代码行数:25,代码来源:test_mqtt.py

示例3: test_find_in_range_altered_inverted

    def test_find_in_range_altered_inverted(self):
        """Test find 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(120, mqtt_cover.find_in_range_from_percent(60))
开发者ID:compvter,项目名称:home-assistant,代码行数:8,代码来源:test_mqtt.py

示例4: test_find_in_range_defaults_inverted

    def test_find_in_range_defaults_inverted(self):
        """Test find 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(44, mqtt_cover.find_in_range_from_percent(56))
开发者ID:compvter,项目名称:home-assistant,代码行数:8,代码来源:test_mqtt.py

示例5: test_find_percentage_in_range_altered

    def test_find_percentage_in_range_altered(self):
        """Test find percentage in range with altered range."""
        mqtt_cover = MqttCover(
            'cover.test', 'foo', 'bar', 'fooBar', "fooBarBaz", 0, False,
            'OPEN', 'CLOSE', 'OPEN', 'CLOSE', 'STOP', False, None,
            180, 80, 80, 180, False, False)

        self.assertEqual(40, mqtt_cover.find_percentage_in_range(120))
开发者ID:compvter,项目名称:home-assistant,代码行数:8,代码来源:test_mqtt.py

示例6: test_find_percentage_in_range_defaults

    def test_find_percentage_in_range_defaults(self):
        """Test find percentage in range with default range."""
        mqtt_cover = MqttCover(
            'cover.test', 'foo', 'bar', 'fooBar', "fooBarBaz", 0, False,
            'OPEN', 'CLOSE', 'OPEN', 'CLOSE', 'STOP', False, None,
            100, 0, 0, 100, False, False)

        self.assertEqual(44, mqtt_cover.find_percentage_in_range(44))
开发者ID:compvter,项目名称:home-assistant,代码行数:8,代码来源:test_mqtt.py

示例7: test_find_in_range_altered_inverted

    def test_find_in_range_altered_inverted(self):
        """Test find 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(120, mqtt_cover.find_in_range_from_percent(60))
开发者ID:BaptisteSim,项目名称:home-assistant,代码行数:9,代码来源:test_mqtt.py

示例8: test_find_in_range_defaults_inverted

    def test_find_in_range_defaults_inverted(self):
        """Test find 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(44, mqtt_cover.find_in_range_from_percent(56))
开发者ID:BaptisteSim,项目名称:home-assistant,代码行数:9,代码来源:test_mqtt.py

示例9: test_find_percentage_in_range_defaults

    def test_find_percentage_in_range_defaults(self):
        """Test find percentage in range with default range."""
        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, False, None, None)

        self.assertEqual(44, mqtt_cover.find_percentage_in_range(44))
开发者ID:BaptisteSim,项目名称:home-assistant,代码行数:9,代码来源:test_mqtt.py


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