Code Monkey home page Code Monkey logo

Comments (8)

syssi avatar syssi commented on August 14, 2024

This is strange. The value of state.air_condition_model should be bytes and not a string. Which version of python-miio do you use?

from xiaomi_airconditioningcompanion.

syssi avatar syssi commented on August 14, 2024

Which HA version do you use?

from xiaomi_airconditioningcompanion.

heyggu avatar heyggu commented on August 14, 2024

python-miio version:0.4.0
HA:0.76.2

from xiaomi_airconditioningcompanion.

syssi avatar syssi commented on August 14, 2024

I'm unable to reproduce the issue:

# configuration.yaml

logger:                                                                                                                                                                                                                                        
  default: warn                                                                                                                                                                                                                                
  logs:                                                                                                                                                                                                                                        
    custom_components.climate.xiaomi_miio: debug                                                                                                                                                                                               
    miio: debug                                                                                                                                                                                                                                

# just for testing                                                                                                                                                                                                                                               
sensor:                                                                                                                                                                                                                                        
  - platform: template
    sensors:
      temperature:
        friendly_name: "Simulated temperature"
        unit_of_measurement: '°C'
        value_template: 30.5

climate:
  - platform: xiaomi_miio
    name: AC Partner
    host: 192.168.130.83
    token: acf23c57a96e37d7a007ac484c1dca63
    target_sensor: sensor.temperature
$ bin/hass --debug
Config directory: /home/sebastian/.homeassistant
2018-08-22 20:16:20 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=homeassistant, service=turn_off>
2018-08-22 20:16:20 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=homeassistant, service=turn_on>
2018-08-22 20:16:20 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=homeassistant, service=toggle>
2018-08-22 20:16:20 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=homeassistant, service=stop>
2018-08-22 20:16:20 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=homeassistant, service=restart>
2018-08-22 20:16:20 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=homeassistant, service=check_config>
2018-08-22 20:16:20 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=homeassistant, service=reload_core_config>
2018-08-22 20:16:20 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=persistent_notification, service=create>
2018-08-22 20:16:20 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=persistent_notification, service=dismiss>
2018-08-22 20:16:20 INFO (MainThread) [homeassistant.bootstrap] Home Assistant core initialized
2018-08-22 20:16:20 INFO (MainThread) [homeassistant.loader] Loaded logger from homeassistant.components.logger
2018-08-22 20:16:20 INFO (MainThread) [homeassistant.setup] Setting up logger
2018-08-22 20:16:20 WARNING (MainThread) [homeassistant.components.http] You have been advised to set http.api_password.
2018-08-22 20:16:20 WARNING (MainThread) [homeassistant.loader] You are using a custom component for climate.xiaomi_miio which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2018-08-22 20:16:21 INFO (MainThread) [custom_components.climate.xiaomi_miio] Initializing with host 192.168.130.83 (token acf23...)
2018-08-22 20:16:21 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2018-08-22 20:16:21 DEBUG (MainThread) [miio.device] Got a response: Container: 
    data = Container: 
        length = 0
        value = b'' (total 0)
        data = b'' (total 0)
        offset1 = 32
        offset2 = 32
    header = Container: 
        length = 16
        value = Container: 
            length = 32
            unknown = 0
            device_id = b'\x03F\xeb\x98' (total 4)
            ts = 1970-01-01 00:01:03
        data = b'!1\x00 \x00\x00\x00\x00\x03F\xeb\x98\x00\x00\x00?' (total 16)
        offset1 = 0
        offset2 = 16
    checksum = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' (total 16)
2018-08-22 20:16:21 DEBUG (MainThread) [miio.device] Discovered 0346eb98 with ts: 1970-01-01 00:01:03, token: b'00000000000000000000000000000000'
2018-08-22 20:16:21 DEBUG (MainThread) [miio.device] 192.168.130.83:54321 >>: {'method': 'miIO.info', 'params': [], 'id': 1}
2018-08-22 20:16:21 DEBUG (MainThread) [miio.device] 192.168.130.83:54321 (ts: 1970-01-01 00:01:03, id: 1) << {'id': 1, 'result': {'hw_ver': 'MW300', 'cfg_time': 0, 'life': 63, 'fw_ver': '1.4.1_147', 'ott_stat': [0, 0, 0, 0], 'ap': {'rssi': -74, 'ssid': 'Greendale', 'bssid': 'C0:25:06:A8:9A:5E'}, 'wifi_fw_ver': 'SD878x-14.76.36.p84-702.1.0-WM', 'mac': '28:6C:07:F0:EC:29', 'ot': 'otu', 'model': 'lumi.acpartner.v1', 'mmfree': 170616, 'token': 'acf23c57a96e37d7a007ac484c1dca63', 'netif': {'gw': '192.168.130.1', 'mask': '255.255.255.0', 'localIp': '192.168.130.83', 'gw_mac': 'C0:25:06:A8:9A:58'}, 'mcu_fw_ver': '0143', 'otu_stat': [330, 544, 11, 0, 11, 3120]}}
2018-08-22 20:16:21 INFO (MainThread) [custom_components.climate.xiaomi_miio] lumi.acpartner.v1 1.4.1_147 MW300 detected
2018-08-22 20:16:21 DEBUG (Thread-17) [miio.device] 192.168.130.83:54321 >>: {'method': 'get_model_and_state', 'params': [], 'id': 2}
2018-08-22 20:16:21 DEBUG (Thread-17) [miio.device] 192.168.130.83:54321 (ts: 1970-01-01 00:01:03, id: 2) << {'id': 2, 'result': ['010501870001050201', '010131180100010502', '0']}
2018-08-22 20:16:21 DEBUG (MainThread) [custom_components.climate.xiaomi_miio] Got new state: <AirConditioningCompanionStatus power=off, load_power=0, air_condition_model=010501870001050201, model_format=1, device_type=5,air_condition_brand=187,air_condition_remote=10502,state_format=1,air_condition_configuration=01311801,led=True, target_temperature=24, swing_mode=SwingMode.Off, fan_speed=FanSpeed.Auto, mode=OperationMode.Cool>
2018-08-22 20:16:36 DEBUG (Thread-13) [miio.device] 192.168.130.83:54321 >>: {'method': 'get_model_and_state', 'params': [], 'id': 3}
2018-08-22 20:16:36 DEBUG (Thread-13) [miio.device] 192.168.130.83:54321 (ts: 1970-01-01 00:01:18, id: 3) << {'id': 3, 'result': ['010501870001050201', '010131180100010502', '0']}
2018-08-22 20:16:36 DEBUG (MainThread) [custom_components.climate.xiaomi_miio] Got new state: <AirConditioningCompanionStatus power=off, load_power=0, air_condition_model=010501870001050201, model_format=1, device_type=5,air_condition_brand=187,air_condition_remote=10502,state_format=1,air_condition_configuration=01311801,led=True, target_temperature=24, swing_mode=SwingMode.Off, fan_speed=FanSpeed.Auto, mode=OperationMode.Cool>

Could you provide the same log?

from xiaomi_airconditioningcompanion.

heyggu avatar heyggu commented on August 14, 2024

Here is the log

2018-08-23 19:29:14 WARNING (MainThread) [homeassistant.loader] You are using a custom component for dlna which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2018-08-23 19:29:14 WARNING (MainThread) [homeassistant.loader] You are using a custom component for sensor.aircat which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2018-08-23 19:29:15 WARNING (MainThread) [homeassistant.loader] You are using a custom component for device_tracker.padavan_tracker which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2018-08-23 19:29:15 WARNING (MainThread) [homeassistant.loader] You are using a custom component for switch.broadlink_mp1 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2018-08-23 19:29:15 WARNING (MainThread) [homeassistant.loader] You are using a custom component for hello_miai which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2018-08-23 19:29:15 WARNING (MainThread) [homeassistant.loader] You are using a custom component for climate.xiaomi_miio which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2018-08-23 19:29:32 INFO (MainThread) [custom_components.climate.xiaomi_miio] Initializing with host 192.168.11.178 (token 2ae89...)
2018-08-23 19:29:32 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2018-08-23 19:29:32 DEBUG (MainThread) [miio.device] Got a response: Container:
data = Container:
offset2 = 32
offset1 = 32
length = 0
value = b'' (total 0)
data = b'' (total 0)
header = Container:
offset2 = 16
offset1 = 0
length = 16
value = Container:
length = 32
unknown = 0
device_id = b'\x03\x90\x0b\xc3' (total 4)
ts = 1970-01-17 00:23:54
data = b'!1\x00 \x00\x00\x00\x00\x03\x90\x0b\xc3\x00\x15\x1d\x9a' (total 16)
checksum = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' (total 16)
2018-08-23 19:29:32 DEBUG (MainThread) [miio.device] Discovered 03900bc3 with ts: 1970-01-17 00:23:54, token: b'00000000000000000000000000000000'
2018-08-23 19:29:33 DEBUG (MainThread) [miio.device] 192.168.11.178:54321 >>: {'id': 1, 'params': [], 'method': 'miIO.info'}
2018-08-23 19:29:33 DEBUG (MainThread) [miio.device] 192.168.11.178:54321 (ts: 1970-01-17 00:23:55, id: 1) << {'id': 1, 'result': {'ap': {'ssid': 'GG', 'bssid': '20:76:93:26:D9:7D', 'rssi': -38}, 'netif': {'localIp': '192.168.11.178', 'gw': '192.168.11.1', 'mask': '255.255.255.0', 'gw_mac': '20:76:93:26:D9:7D'}, 'cfg_time': 0, 'ot': 'otu', 'fw_ver': '1.4.1_144', 'mac': '34:CE:00:95:38:BE', 'mcu_fw_ver': '0143', 'ott_stat': [2, 4, 516, 15], 'otu_stat': [43, 43, 8302, 4, 8291, 57], 'mmfree': 169728, 'wifi_fw_ver': 'SD878x-14.76.36.p84-702.1.0-WM', 'hw_ver': 'MW300', 'token': '2ae890b8d3a8bc5e46d7b83d5d40b491', 'model': 'lumi.acpartner.v2', 'life': 1383835}}
2018-08-23 19:29:33 INFO (MainThread) [custom_components.climate.xiaomi_miio] lumi.acpartner.v2 1.4.1_144 MW300 detected
2018-08-23 19:29:33 DEBUG (Thread-10) [miio.device] 192.168.11.178:54321 >>: {'id': 2, 'params': [], 'method': 'get_model_and_state'}
2018-08-23 19:29:33 DEBUG (Thread-10) [miio.device] 192.168.11.178:54321 (ts: 1970-01-17 00:23:55, id: 2) << {'id': 2, 'result': ['010500170000527701', '010131190100005277', '0']}
2018-08-23 19:29:33 ERROR (MainThread) [homeassistant.components.climate] xiaomi_miio: Error on device update!
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/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.5/site-packages/homeassistant/helpers/entity.py", line 320, in async_device_update
yield from self.async_update()
File "/home/homeassistant/.homeassistant/custom_components/climate/xiaomi_miio.py", line 268, in async_update
ATTR_AIR_CONDITION_MODEL: state.air_condition_model.hex(),
AttributeError: 'str' object has no attribute 'hex'

from xiaomi_airconditioningcompanion.

syssi avatar syssi commented on August 14, 2024

Perfect! A last thing. Could you provide the output of:

cat /srv/homeassistant/lib/python3.5/site-packages/miio/version.py

Thanks!

from xiaomi_airconditioningcompanion.

heyggu avatar heyggu commented on August 14, 2024

Here....

pi@hassbian:~ $ cat /srv/homeassistant/lib/python3.5/site-packages/miio/version.py
# flake8: noqa
__version__ = "0.4.0"

from xiaomi_airconditioningcompanion.

heyggu avatar heyggu commented on August 14, 2024

Work fine after reinstall.Thanks🙂

from xiaomi_airconditioningcompanion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.