syssi / xiaomiplug

Xiaomi Mi Smart WiFi Socket integration for Home Assistant
Apache License 2.0
107 stars 26 forks source link

acpartner v3 error #12

Closed mouth4war closed 5 years ago

mouth4war commented 5 years ago
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 224, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/home/homeassistant/.homeassistant/custom_components/switch/xiaomi_miio.py", line 515, in async_turn_on
    "Turning the socket on failed.", self._plug.socket_on)
AttributeError: 'AirConditioningCompanion' object has no attribute 'socket_on'
mouth4war commented 5 years ago

Config:

  - platform: xiaomi_miio
    host: 192.168.31.137
    name: xxx
    token: xxx
    model: lumi.acpartner.v3
mouth4war commented 5 years ago

debug shows that it cannot initialize the acpartners. No state updates are received.

Initializing with host 192.168.31.184 (token d0abe...)

Don't know if relevant but I am also using the gateway function in HASS by adding them in xiaomi_aqara section.

mouth4war commented 5 years ago

I wonder if its because I have not linked a remote to the devices in Mi Home? I removed model from config and got this exception:

--- Logging error ---
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/logging/__init__.py", line 992, in emit
    msg = self.format(record)
  File "/usr/local/lib/python3.6/logging/__init__.py", line 838, in format
    return fmt.format(record)
  File "/srv/homeassistant/lib/python3.6/site-packages/colorlog/colorlog.py", line 119, in format
    message = super(ColoredFormatter, self).format(record)
  File "/usr/local/lib/python3.6/logging/__init__.py", line 575, in format
    record.message = record.getMessage()
  File "/usr/local/lib/python3.6/logging/__init__.py", line 338, in getMessage
    msg = msg % self.args
  File "/srv/homeassistant/lib/python3.6/site-packages/miio/airconditioningcompanion.py", line 259, in __repr__
    self.air_condition_remote,
  File "/srv/homeassistant/lib/python3.6/site-packages/miio/airconditioningcompanion.py", line 164, in air_condition_remote
    return int(self.air_condition_model[4:8].hex())
ValueError: invalid literal for int() with base 10: 'ffffffff'
Call stack:
  File "/srv/homeassistant/bin/hass", line 11, in <module>
    sys.exit(main())
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/__main__.py", line 389, in main
    exit_code = asyncio_run(setup_and_run_hass(config_dir, args))
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/util/async_.py", line 29, in asyncio_run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.6/asyncio/base_events.py", line 454, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.6/asyncio/base_events.py", line 421, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.6/asyncio/base_events.py", line 1426, in _run_once
    handle._run()
  File "/usr/local/lib/python3.6/asyncio/events.py", line 127, in _run
    self._callback(*self._args)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 347, in async_device_update
    await self.async_update()
  File "/home/homeassistant/.homeassistant/custom_components/switch/xiaomi_miio.py", line 541, in async_update
    _LOGGER.debug("Got new state: %s", state)
Unable to print the message and arguments - possible formatting error.
Use the traceback above to help find the error.
mouth4war commented 5 years ago

So, switching modes in Mi Home app from 16a plug to AC gets a state response from the device in HASS but it still doesn't work (gives the 'AirConditioningCompanion' object has no attribute 'socket_on' error).

syssi commented 5 years ago

Thanks for the testing! Please update the custom component and try again. :-)

syssi commented 5 years ago

If it doesn't work out of the box please enable the debug output and provide some logs:

# configuration.yaml
logger:
  default: warn
  logs:
    custom_components.switch.xiaomi_miio: debug
    miio: debug