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


Python Entity.entity_id方法代码示例

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


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

示例1: _compute_state

# 需要导入模块: from homeassistant.helpers.entity import Entity [as 别名]
# 或者: from homeassistant.helpers.entity.Entity import entity_id [as 别名]
    def _compute_state(self, config):
        run_coroutine_threadsafe(
            config_util.async_process_ha_core_config(self.hass, config),
            self.hass.loop).result()

        entity = Entity()
        entity.entity_id = 'test.test'
        entity.hass = self.hass
        entity.schedule_update_ha_state()

        self.hass.block_till_done()

        return self.hass.states.get('test.test')
开发者ID:chilicheech,项目名称:home-assistant,代码行数:15,代码来源:test_config.py

示例2: test_entity_customization

# 需要导入模块: from homeassistant.helpers.entity import Entity [as 别名]
# 或者: from homeassistant.helpers.entity.Entity import entity_id [as 别名]
    def test_entity_customization(self):
        """Test entity customization through configuration."""
        config = {CONF_LATITUDE: 50,
                  CONF_LONGITUDE: 50,
                  CONF_NAME: 'Test',
                  CONF_CUSTOMIZE: {'test.test': {'hidden': True}}}

        bootstrap.process_ha_core_config(self.hass, config)

        entity = Entity()
        entity.entity_id = 'test.test'
        entity.hass = self.hass
        entity.update_ha_state()

        state = self.hass.states.get('test.test')

        assert state.attributes['hidden']
开发者ID:1lann,项目名称:home-assistant,代码行数:19,代码来源:test_bootstrap.py

示例3: test_entity_customization

# 需要导入模块: from homeassistant.helpers.entity import Entity [as 别名]
# 或者: from homeassistant.helpers.entity.Entity import entity_id [as 别名]
    def test_entity_customization(self):
        """ Test entity customization through config """
        config = {CONF_LATITUDE: 50,
                  CONF_LONGITUDE: 50,
                  CONF_NAME: 'Test',
                  CONF_CUSTOMIZE: {'test.test': {'hidden': True}}}

        hass = get_test_home_assistant()

        bootstrap.process_ha_core_config(hass, config)

        entity = Entity()
        entity.entity_id = 'test.test'
        entity.hass = hass
        entity.update_ha_state()

        state = hass.states.get('test.test')

        self.assertTrue(state.attributes['hidden'])
        hass.stop()
开发者ID:100dayproject,项目名称:home-assistant,代码行数:22,代码来源:test_bootstrap.py

示例4: test_entity_customization

# 需要导入模块: from homeassistant.helpers.entity import Entity [as 别名]
# 或者: from homeassistant.helpers.entity.Entity import entity_id [as 别名]
    def test_entity_customization(self):
        """Test entity customization through configuration."""
        self.hass = get_test_home_assistant()

        config = {CONF_LATITUDE: 50,
                  CONF_LONGITUDE: 50,
                  CONF_NAME: 'Test',
                  CONF_CUSTOMIZE: {'test.test': {'hidden': True}}}

        config_util.process_ha_core_config(self.hass, config)

        entity = Entity()
        entity.entity_id = 'test.test'
        entity.hass = self.hass
        entity.update_ha_state()

        self.hass.block_till_done()

        state = self.hass.states.get('test.test')

        assert state.attributes['hidden']
开发者ID:krzynio,项目名称:home-assistant,代码行数:23,代码来源:test_config.py

示例5: test_entity_customization

# 需要导入模块: from homeassistant.helpers.entity import Entity [as 别名]
# 或者: from homeassistant.helpers.entity.Entity import entity_id [as 别名]
    def test_entity_customization(self):
        """Test entity customization through configuration."""
        config = {CONF_LATITUDE: 50,
                  CONF_LONGITUDE: 50,
                  CONF_NAME: 'Test',
                  CONF_CUSTOMIZE: {'test.test': {'hidden': True}}}

        run_coroutine_threadsafe(
            config_util.async_process_ha_core_config(self.hass, config),
            self.hass.loop).result()

        entity = Entity()
        entity.entity_id = 'test.test'
        entity.hass = self.hass
        entity.update_ha_state()

        self.hass.block_till_done()

        state = self.hass.states.get('test.test')

        assert state.attributes['hidden']
开发者ID:DavidLP,项目名称:home-assistant,代码行数:23,代码来源:test_config.py

示例6: test_merge_customize

# 需要导入模块: from homeassistant.helpers.entity import Entity [as 别名]
# 或者: from homeassistant.helpers.entity.Entity import entity_id [as 别名]
def test_merge_customize(hass):
    """Test loading core config onto hass object."""
    core_config = {
        'latitude': 60,
        'longitude': 50,
        'elevation': 25,
        'name': 'Huis',
        CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_IMPERIAL,
        'time_zone': 'GMT',
        'customize': {'a.a': {'friendly_name': 'A'}},
        'packages': {'pkg1': {'homeassistant': {'customize': {
            'b.b': {'friendly_name': 'BB'}}}}},
    }
    yield from config_util.async_process_ha_core_config(hass, core_config)

    entity = Entity()
    entity.entity_id = 'b.b'
    entity.hass = hass
    yield from entity.async_update_ha_state()

    state = hass.states.get('b.b')
    assert state is not None
    assert state.attributes['friendly_name'] == 'BB'
开发者ID:Teagan42,项目名称:home-assistant,代码行数:25,代码来源:test_config.py


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