Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.4.5 AttributeError: 'str' object has no attribute 'service' #205

Closed
PedroNeer opened this issue Oct 6, 2021 · 7 comments
Closed

v0.4.5 AttributeError: 'str' object has no attribute 'service' #205

PedroNeer opened this issue Oct 6, 2021 · 7 comments
Labels
bug Something isn't working device: motion fixed bug fixed

Comments

@PedroNeer
Copy link

PedroNeer commented Oct 6, 2021

lumi.motion.bmgl01
制造商:lumi
固件:1.1.1_0010
sensor.lumi_bmgl01_ea2c_illumination失效,和升级0.4.5时间吻合
image

相关日志:

File "/config/custom_components/xiaomi_miot/__init__.py", line 1496, in _update_sub_entities
    self._subs[fnm] = MiotModesSubEntity(self, p, option=opt)
  File "/config/custom_components/xiaomi_miot/fan.py", line 313, in __init__
    super().__init__(parent, miot_property.full_name, option)
  File "/config/custom_components/xiaomi_miot/__init__.py", line 1823, in __init__
    super().__init__(parent, attr, option)
  File "/config/custom_components/xiaomi_miot/__init__.py", line 1790, in __init__
    self._miot_service = miot_property.service
AttributeError: 'str' object has no attribute 'service'
2021-10-07 00:32:57 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.mmgg_s1_fec0_pet_drinking_fountain fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 438, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 625, in async_device_update
    raise exc
  File "/config/custom_components/xiaomi_miot/switch.py", line 134, in async_update
    self._update_sub_entities(
  File "/config/custom_components/xiaomi_miot/__init__.py", line 1496, in _update_sub_entities
    self._subs[fnm] = MiotModesSubEntity(self, p, option=opt)
  File "/config/custom_components/xiaomi_miot/fan.py", line 313, in __init__
    super().__init__(parent, miot_property.full_name, option)
  File "/config/custom_components/xiaomi_miot/__init__.py", line 1823, in __init__
    super().__init__(parent, attr, option)
  File "/config/custom_components/xiaomi_miot/__init__.py", line 1790, in __init__
    self._miot_service = miot_property.service
AttributeError: 'str' object has no attribute 'service'
2021-10-07 00:33:27 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.mmgg_s1_fec0_pet_drinking_fountain fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 438, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 625, in async_device_update
    raise exc
  File "/config/custom_components/xiaomi_miot/switch.py", line 134, in async_update
    self._update_sub_entities(
  File "/config/custom_components/xiaomi_miot/__init__.py", line 1496, in _update_sub_entities
    self._subs[fnm] = MiotModesSubEntity(self, p, option=opt)
  File "/config/custom_components/xiaomi_miot/fan.py", line 313, in __init__
    super().__init__(parent, miot_property.full_name, option)
  File "/config/custom_components/xiaomi_miot/__init__.py", line 1823, in __init__
    super().__init__(parent, attr, option)
  File "/config/custom_components/xiaomi_miot/__init__.py", line 1790, in __init__
    self._miot_service = miot_property.service
AttributeError: 'str' object has no attribute 'service'
@al-one al-one added the bug Something isn't working label Oct 7, 2021
@al-one
Copy link
Owner

al-one commented Oct 9, 2021

请升级到master后重试。

@PedroNeer
Copy link
Author

PedroNeer commented Oct 10, 2021

image
image

修复的代码可能和问题无关,日志里没有错误了(可能是风扇),但传感器还是少了亮度的属性

@al-one
Copy link
Owner

al-one commented Oct 11, 2021

该型号人体传感器miot-spec规格中的illumination属性并非真实的照度值,此属性仅有两个值:1: weak 2: strong,只能表明当前光线强弱,你可以从实体属性illumination_level得到它的值。

@al-one al-one added the fixed bug fixed label Oct 11, 2021
@PedroNeer PedroNeer reopened this Oct 13, 2021
@PedroNeer
Copy link
Author

该型号人体传感器miot-spec规格中的illumination属性并非真实的照度值,此属性仅有两个值:1: weak 2: strong,只能表明当前光线强弱,你可以从实体属性illumination_level得到它的值。

我再回滚下代码试下,#189 这个问题fix之后的版本是可以正常使用的,记得数据曲线是有值,测试完给你同步下

@PedroNeer
Copy link
Author

PedroNeer commented Oct 13, 2021

该型号人体传感器miot-spec规格中的illumination属性并非真实的照度值,此属性仅有两个值:1: weak 2: strong,只能表明当前光线强弱,你可以从实体属性illumination_level得到它的值。

revert回到这个tag后这个实体sensor.lumi_bmgl01_ea2c_illumination恢复可用了 aeddb27

此外确实如你所说只有两个值,之前一直是256和0,不是光照的数值lx

image
image

@al-one
Copy link
Owner

al-one commented Oct 14, 2021

是的。这两个值代表光线强弱,因此后面我把照度实体移除了。可以从人体传感器实体的illumination_level属性获取。

@PedroNeer
Copy link
Author

恩,好的谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working device: motion fixed bug fixed
Projects
None yet
Development

No branches or pull requests

2 participants