Yonsm/ZhiMsg

更新到10.1出错

jasonhorga opened this issue · 1 comments

Logger: homeassistant.setup
Source: components/input_text/__init__.py:252 
First occurred: 13:40:18 (1 occurrences) 
Last logged: 13:40:18

Error during setup of component zhimsg
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 235, in _async_setup_component
    result = await task
  File "/config/custom_components/zhimsg/__init__.py", line 64, in async_setup
    await async_add_input_entities(hass, entities)
  File "/config/custom_components/zhimsg/__init__.py", line 120, in async_add_input_entities
    await component.async_add_entities(entities)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 691, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 777, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 574, in _async_write_ha_state
    attr.update(self.extra_state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/input_text/__init__.py", line 252, in extra_state_attributes
    ATTR_EDITABLE: self.editable,
AttributeError: 'InputText' object has no attribute 'editable'

把注释去掉后OK了

def create_input_entity(hass, name, service, initial_text):
    config = {
        CONF_ID: service,
        CONF_NAME: name,
        CONF_MIN: CONF_MIN_VALUE,
        CONF_MAX: CONF_MAX_VALUE,
        CONF_INITIAL: initial_text,
        CONF_ICON: 'mdi:account-tie-voice',
        CONF_MODE: MODE_TEXT
    }
    entity = InputText(config)
    entity.entity_id = f"input_text.{service}"
    #entity.editable = False
    return entity