syssi / xiaomi_airconditioningcompanion

Xiaomi Mi and Aqara Air Conditioning Companion integration for Home Assistant
Apache License 2.0
401 stars 94 forks source link

Component doesn't work #7

Closed liorm0505 closed 6 years ago

liorm0505 commented 6 years ago

Hi, i have an Aqara Air Conditioning Companion (Air condition partner) which i believe is the one relevant for this component. I can ping the gateway and i get no errors while hassio boots but for some reason i get the following error when i click the on/off button in the dashboard:

Error executing service <ServiceCall climate.turn_off: entity_id=['climate.aqara_air_conditioning_companion']> Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/homeassistant/core.py", line 1010, in _event_to_service_call yield from service_handler.func(service_call) File "/usr/lib/python3.6/site-packages/homeassistant/components/climate/init.py", line 443, in async_on_off_service yield from climate.async_turn_off() File "/usr/lib/python3.6/asyncio/futures.py", line 332, in iter yield self # This tells Task to wait for completion. File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup future.result() File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result raise self._exception File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3.6/site-packages/homeassistant/components/climate/init.py", line 773, in turn_off raise NotImplementedError() NotImplementedError

The FW version is: 1.41_145.0143

needless to say that i see no response from my ac.

I have some basic linux and coding (mainly python) skills. I would like to help testing this component.

love your work, Lior.

syssi commented 6 years ago

Cool! Thanks for your support. I will check your issue and will provide feedback asap!

syssi commented 6 years ago

Is the power plug of your AC connected with the AC Companion? Could you try to execute some commands with the command line tool supplied by python-miio:

pip3 install python-miio
mirobo --ip <ip-of-your-gateway> --token <your-token> -d info
mirobo --ip <ip-of-your-gateway> --token <your-token> raw_command set_power "['on']"
mirobo --ip <ip-of-your-gateway> --token <your-token> raw_command set_power "['off']"

Does the commands toggle the power of the socket? The turn_on/turn_off service isn't implemented right now. The command to control the socket is unknown right now.

liorm0505 commented 6 years ago

Thank you for the fast response,

I am running HASSIO on a pi3, when i try typing pip3 or python3 i get "command not found". Is it possible to install python3 on hassio system?

Regarding your question: Yes, my AC is connected to the power through the AC companion.

syssi commented 6 years ago

Do you have another linux host to execute the command? If not I will tell you how to enter the correct docker container which I would like to avoid.

liorm0505 commented 6 years ago

Well, I do not have another Linux host but maybe I can set one on another SD card using the snapshot I did(this will require some time obviously but I can do it in the evening ~10 from now). BTW, can't we download Python and deploy it manually?

syssi commented 6 years ago

Okay, we can work with your hassio setup without the need of installing anything. Please follow this how to: https://home-assistant.io/developers/hassio/debugging/

You are able to SSH into your hassio device afterwards. This is the host system and not the hassio supervisor accessible by the SSH plugin. We can list the docker containers now:

docker ps

We want an interactive shell at the homeassistant container:

docker exec -it home-assistant /bin/bash

python-miio is installed already by homeassistant / the xiaomi_miio component. The command should work out of the box:

mirobo --ip <ip-of-your-gateway> --token <your-token> -d info
mirobo --ip <ip-of-your-gateway> --token <your-token> raw_command set_power "['on']"
mirobo --ip <ip-of-your-gateway> --token <your-token> raw_command set_power "['off']"
liorm0505 commented 6 years ago

Hi, Thank you for the instructions. It's all clear. I will work on that once will get home.

syssi commented 6 years ago

Take your time! I'm happy about your testing.

liorm0505 commented 6 years ago

Hi, I was able to ssh the host successfully, however when i try accessing the container you provided it is not listed. hear is the container list:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 6e1628fe9356 homeassistant/raspberrypi3-homeassistant "/usr/bin/entry.sh..." 2 minutes ago Up 2 minutes homeassistant 8ade834380a2 hassioaddons/terminal-armhf "/init" 2 minutes ago Up 2 minutes 0.0.0.0:7681->7681/tcp addon_a0d7b954_terminal ed5b0cde1e82 homeassistant/armhf-addon-duckdns "/usr/bin/entry.sh..." 2 minutes ago Up 2 minutes addon_core_duckdns 762a80dd42e7 homeassistant/armhf-addon-samba "/usr/bin/entry.sh..." 2 minutes ago Up 2 minutes addon_core_samba d0efd0d2cee5 homeassistant/armhf-addon-rpc_shutdown "/usr/bin/entry.sh..." 2 minutes ago Up 2 minutes addon_core_rpc_shutdown cba39f51af45 homeassistant/armhf-addon-ssh "/usr/bin/entry.sh..." 2 minutes ago Up 2 minutes 0.0.0.0:22->22/tcp addon_core_ssh edc37b5d112c homeassistant/armhf-addon-mosquitto "/usr/bin/entry.sh..." 2 minutes ago Up 2 minutes 0.0.0.0:1883->1883/tcp, 0.0.0.0:8883->8883/tcp addon_core_mosquitto 3e199b723fee homeassistant/armhf-hassio-supervisor "/usr/bin/entry.sh..." About an hour ago Up 2 minutes resin_supervisor

which one shell i choose?

update: it seems like when i remove the dash from the command you gave me (i.e: docker exec -it homeassistant /bin/bash) i get the bash command line. Is that correct?

liorm0505 commented 6 years ago

Great Progress!

sending your command result in powering on/off the ac. looks like it's working :)

For the info command i get this output:

bash-4.4# mirobo --ip 192.168.1.44 --token aefec50f78892923193f571a031a7c08 -d info
INFO:miio.vacuum_cli:Debug mode active
DEBUG:miio.vacuum_cli:Connecting to 192.168.1.44 with token aefec50f78892923193f571a031a7c08
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.device:Got a response: Container:
    data = Container:
        data =  (total 0)
        value =  (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container:
        data = !1\x00 \x00\x00\x00\x00\x03F\xda\xce\x00\x08\xef| (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = \x03F\xda\xce (total 4)
            ts = 1970-01-07 18:39:56
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (total 16)
DEBUG:miio.device:Discovered unhexlify('0346dace') with ts: 1970-01-07 18:39:56, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.44:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
DEBUG:miio.device:192.168.1.44:54321 (ts: 1970-01-07 18:39:57, id: 1) << {'result': {'life': 585597, 'cfg_time': 0, 'token': 'aefec50f78892923193f571a031a7c08', 'mac': '28:6C:07:F0:DB:5F', 'fw_ver': '1.4.1_145', 'hw_ver': 'MW300', 'model': 'lumi.acpartner.v1', 'mcu_fw_ver': '0143', 'wifi_fw_ver': 'SD878x-14.76.36.p84-702.1.0-WM', 'ap': {'rssi': -39, 'ssid': 'Lior_Lital_livingroom', 'bssid': '74:DA:38:A3:98:C9'}, 'netif': {'localIp': '192.168.1.44', 'mask': '255.255.255.0', 'gw': '192.168.1.1', 'gw_mac': 'D0:0F:6D:F1:73:C2'}, 'mmfree': 170136, 'ot': 'ott', 'otu_stat': [533, 409, 3890, 39, 3835, 214], 'ott_stat': [2, 0, 610, 418]}, 'id': 1}
lumi.acpartner.v1 v1.4.1_145 (28:6C:07:F0:DB:5F) @ 192.168.1.44 - token: xxxxxxxxxmy_tokenxxxxxx
DEBUG:miio.vacuum_cli:Full response: {'ap': {'bssid': '74:DA:38:A3:98:C9',
        'rssi': -39,
        'ssid': 'Lior_Lital_livingroom'},
 'cfg_time': 0,
 'fw_ver': '1.4.1_145',
 'hw_ver': 'MW300',
 'life': 585597,
 'mac': '28:6C:07:F0:DB:5F',
 'mcu_fw_ver': '0143',
 'mmfree': 170136,
 'model': 'lumi.acpartner.v1',
 'netif': {'gw': '192.168.1.1',
           'gw_mac': 'D0:0F:6D:F1:73:C2',
           'localIp': '192.168.1.44',
           'mask': '255.255.255.0'},
 'ot': 'ott',
 'ott_stat': [2, 0, 610, 418],
 'otu_stat': [533, 409, 3890, 39, 3835, 214],
 'token': 'xxxxxxxxxmy_tokenxxxxxx',
 'wifi_fw_ver': 'SD878x-14.76.36.p84-702.1.0-WM'}
DEBUG:miio.vacuum_cli:Writing {'seq': 1, 'manual_seq': 0} to /root/.cache/python-miio/python-mirobo.seq
syssi commented 6 years ago

Perfect! I will implement the turn_{on,off} service as soon as possible.

liorm0505 commented 6 years ago

On the same note,

Is it possible to expose this service as a switch so we will have the ability to control it via Google Assistant?

Thanks.

syssi commented 6 years ago

Sure!

syssi commented 6 years ago

Could you try to retrieve the current power state:

mirobo --ip <ip-of-your-gateway> --token <your-token> raw_command get_prop "['power']"

Does it return "on" and "off"?

liorm0505 commented 6 years ago

Hi, After sending this command i get:

bash-4.4# mirobo --ip 192.168.1.44 --token aefec50f78892923193f571a031a7c08 raw_command get_prop "['power']"
Sending cmd get_prop with params ['power']
[None]

I get the same response regardless if the AC is on or off.

BTW - maybe i can help exploring additional commands using this tool. Is there any documentation on these "raw commands" we are sending to the device?

syssi commented 6 years ago

Thanks for your support. I will provide some additional test cases:

Please turn on the socket power by set_power on and request "get_model_and_state" afterwards. The socket off and request "get_model_and_state" again. Is there a difference?

mirobo --ip <ip-of-your-gateway> --token <your-token> raw_command set_power "['on']"
mirobo --ip <ip-of-your-gateway> --token <your-token> raw_command get_model_and_state "[]"
mirobo --ip <ip-of-your-gateway> --token <your-token> raw_command set_power "['off']"
mirobo --ip <ip-of-your-gateway> --token <your-token> raw_command get_model_and_state "[]"

Please provide the complete output.

liorm0505 commented 6 years ago

Hi,

looks like you'r on to something. We get different response when sending this new command:


bash-4.4# mirobo --ip 192.168.1.44 --token aefec50f78892923193f571a031a7c08 raw_command set_power "['on']"
Sending cmd set_power with params ['on']
['ok']
bash-4.4# mirobo --ip 192.168.1.44 --token aefec50f78892923193f571a031a7c08 raw_command get_model_and_state "[]"
Sending cmd get_model_and_state with params []
['010507950000257301', '011001160100002573', '807']
bash-4.4# mirobo --ip 192.168.1.44 --token aefec50f78892923193f571a031a7c08 raw_command set_power "['off']"
Sending cmd set_power with params ['off']
['ok']
bash-4.4# mirobo --ip 192.168.1.44 --token aefec50f78892923193f571a031a7c08 raw_command get_model_and_state "[]"
Sending cmd get_model_and_state with params []
['010507950000257301', '010001160100002573', '6']

BTW - I shell add that the socket itself does not turn the AC on/off. I do see ambient lights on the AC control panel while it's not powered (meaning it's connected to power). The IR blaster (integrated inside the AC companion) is making the job.

syssi commented 6 years ago

Oh, okay. This is fine, too. Do you see flipping the 3rd bit here:

011001160100002573 (AC on)
010001160100002573 (AC off)
  ^ 

This is good.

liorm0505 commented 6 years ago

Yes i do. Excellent.

liorm0505 commented 6 years ago

Looks like we have a third option. I queried the AC once again with your command and got a new response (no changes where made since the last command you told me to send):

bash-4.4# mirobo --ip 192.168.1.44 --token aefec50f78892923193f571a031a7c08 raw_command get_model_and_state "[]"
Sending cmd get_model_and_state with params []
['010507950000257301', '010001160100002573', '1']

The AC is currently off (since the last command we sent). I think this indication is for off state when it's sensed by the power socket.

syssi commented 6 years ago

The third parameter could be the load in watts.

syssi commented 6 years ago

I implemented our new knowledge about the device here: https://github.com/rytilahti/python-miio/pull/233/files

This is the underlying library of this component.

liorm0505 commented 6 years ago

Thanks, So is it possible to apply the changes to my setup? What about temperature/fan/swing/operation, do you want to explore them as well?

syssi commented 6 years ago

Yep, I want to explore them, too. I just need some time for preparing the component update.

syssi commented 6 years ago

Could you execute mirobo discover in the mean time and provide the output? Is the AC partner discoverable by mDNS?

liorm0505 commented 6 years ago

This is what i get when i type this command:

bash-4.4# mirobo discover
INFO:miio.discovery:Discovering devices with mDNS, press any key to quit...

(no change until i hit enter). Should the AC partner be in pairing mode (I.E after reset) while i execute this?

syssi commented 6 years ago

The device should always respond to mDNS requests. Thanks for testing.

syssi commented 6 years ago

Could you provide the output of:

mirobo --ip <ip-of-your-gateway> --token <your-token> raw_command get_model_and_state "[]"
mirobo --ip <ip-of-your-gateway> --token <your-token> raw_command toggle_plug "[]"
mirobo --ip <ip-of-your-gateway> --token <your-token> raw_command get_model_and_state "[]"
mirobo --ip <ip-of-your-gateway> --token <your-token> raw_command toggle_plug "[]"
mirobo --ip <ip-of-your-gateway> --token <your-token> raw_command get_model_and_state "[]"
liorm0505 commented 6 years ago
bash-4.4# mirobo --ip 192.168.1.44 --token aefec50f78892923193f571a031a7c08 raw_command get_model_and_state "[]"
Sending cmd get_model_and_state with params []
['010507950000257301', '010001160100002573', '1']
bash-4.4# mirobo --ip 192.168.1.44 --token aefec50f78892923193f571a031a7c08 raw_command toggle_plug "[]"
Sending cmd toggle_plug with params []
Error: {'code': -32601, 'message': 'Method not found.'}
bash-4.4# mirobo --ip 192.168.1.44 --token aefec50f78892923193f571a031a7c08 raw_command get_model_and_state "[]"
Sending cmd get_model_and_state with params []
['010507950000257301', '010001160100002573', '1']
bash-4.4# mirobo --ip 192.168.1.44 --token aefec50f78892923193f571a031a7c08 raw_command toggle_plug "[]"
Sending cmd toggle_plug with params []
Error: {'code': -32601, 'message': 'Method not found.'}
bash-4.4# mirobo --ip 192.168.1.44 --token aefec50f78892923193f571a031a7c08 raw_command get_model_and_state "[]"
Sending cmd get_model_and_state with params []
['010507950000257301', '010001160100002573', '1']
syssi commented 6 years ago

I have updated the custom component. Please download the latest revision and give it a try.

If something doesn't work as expected enable debug output:

# configuration.yaml
logger:
  default: warn
  logs:
    homeassistant.components.climate.xiaomi_miio: debug
    miio: debug

And provide the content of your home-assistant.log.

liorm0505 commented 6 years ago

Hi,

So the climate panel is gone now. This is what i get in the log: (hope i cached what's needed from the log)

2018-02-26 23:06:44 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2018-02-26 23:06:44 DEBUG (MainThread) [miio.device] Got a response: Container: 
    data = Container: 
        data =  (total 0)
        value =  (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container: 
        data = !1\x00 \x00\x00\x00\x00\x03\xb0\xbf\x95\x00\x0ez\xa2 (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = \x03\xb0\xbf\x95 (total 4)
            ts = 1970-01-11 23:34:58
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (total 16)
2018-02-26 23:06:45 DEBUG (MainThread) [miio.device] Discovered 03b0bf95 with ts: 1970-01-11 23:34:58, token: b'00000000000000000000000000000000'
2018-02-26 23:06:45 DEBUG (MainThread) [miio.device] 192.168.1.26:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
2018-02-26 23:06:45 DEBUG (MainThread) [miio.device] 192.168.1.26:54321 (ts: 1970-01-11 23:34:59, id: 1) << {'result': {'life': 948899, 'token': 'da1e7329c3eaa000b856e8435ea67fed', 'mac': '34:CE:00:C7:78:AD', 'fw_ver': '1.3.0_0033', 'hw_ver': 'ESP8266', 'uid': 1781474662, 'model': 'philips.light.bulb', 'wifi_fw_ver': '1.5.0-dev(7f7a714)', 'ap': {'rssi': -71, 'ssid': 'Lior_Lital_livingroom', 'bssid': '74:DA:38:A3:98:C9'}, 'netif': {'localIp': '192.168.1.26', 'mask': '255.255.255.0', 'gw': '192.168.1.1'}, 'mmfree': 5648}, 'id': 1}
2018-02-26 23:06:45 DEBUG (SyncWorker_6) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2018-02-26 23:06:45 DEBUG (SyncWorker_6) [miio.device] Got a response: Container: 
    data = Container: 
        data =  (total 0)
        value =  (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container: 
        data = !1\x00 \x00\x00\x00\x00\x03\xb0\xbf\x95\x00\x0ez\xa3 (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = \x03\xb0\xbf\x95 (total 4)
            ts = 1970-01-11 23:34:59
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (total 16)
2018-02-26 23:06:45 DEBUG (SyncWorker_6) [miio.device] Discovered 03b0bf95 with ts: 1970-01-11 23:34:59, token: b'00000000000000000000000000000000'
2018-02-26 23:06:46 DEBUG (SyncWorker_6) [miio.device] 192.168.1.26:54321 >>: {'id': 1, 'method': 'get_prop', 'params': ['power', 'bright', 'cct', 'snm', 'dv']}
2018-02-26 23:06:51 ERROR (SyncWorker_6) [miio.device] Got error when receiving: timed out
2018-02-26 23:06:51 WARNING (SyncWorker_6) [miio.device] Retrying with incremented id, retries left: 3
2018-02-26 23:06:51 WARNING (MainThread) [homeassistant.components.light] Setup of platform xiaomi_miio is taking over 10 seconds.
2018-02-26 23:06:51 DEBUG (SyncWorker_6) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2018-02-26 23:06:51 DEBUG (SyncWorker_6) [miio.device] Got a response: Container: 
    data = Container: 
        data =  (total 0)
        value =  (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container: 
        data = !1\x00 \x00\x00\x00\x00\x03\xb0\xbf\x95\x00\x0ez\xa9 (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = \x03\xb0\xbf\x95 (total 4)
            ts = 1970-01-11 23:35:05
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (total 16)
2018-02-26 23:06:51 DEBUG (SyncWorker_6) [miio.device] Discovered 03b0bf95 with ts: 1970-01-11 23:35:05, token: b'00000000000000000000000000000000'
2018-02-26 23:06:51 DEBUG (SyncWorker_6) [miio.device] 192.168.1.26:54321 >>: {'id': 102, 'method': 'get_prop', 'params': ['power', 'bright', 'cct', 'snm', 'dv']}
2018-02-26 23:06:51 DEBUG (SyncWorker_6) [miio.device] 192.168.1.26:54321 (ts: 1970-01-11 23:35:05, id: 102) << {'result': ['on', 100, 100, 0, 0], 'id': 102}
2018-02-26 23:06:57 DEBUG (SyncWorker_16) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2018-02-26 23:06:57 DEBUG (SyncWorker_16) [miio.device] Got a response: Container: 
    data = Container: 
        data =  (total 0)
        value =  (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container: 
        data = !1\x00 \x00\x00\x00\x00\x03F\xda\xce\x00\r+\xbe (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = \x03F\xda\xce (total 4)
            ts = 1970-01-10 23:46:06
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (total 16)
2018-02-26 23:06:57 DEBUG (SyncWorker_16) [miio.device] Discovered 0346dace with ts: 1970-01-10 23:46:06, token: b'00000000000000000000000000000000'
2018-02-26 23:06:57 DEBUG (SyncWorker_16) [miio.device] 192.168.1.44:54321 >>: {'id': 1, 'method': 'get_model_and_state', 'params': []}
2018-02-26 23:06:57 DEBUG (SyncWorker_16) [miio.device] 192.168.1.44:54321 (ts: 1970-01-10 23:46:06, id: 1) << {'result': ['010507950000257301', '010131180100002573', '1'], 'id': 1}
2018-02-26 23:06:57 ERROR (MainThread) [homeassistant.components.climate] xiaomi_miio: Error on device update!
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 197, in _async_add_entity
    yield from entity.async_device_update(warning=False)
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 325, in async_device_update
    yield from self.async_update()
  File "/config/custom_components/climate/xiaomi_miio.py", line 235, in async_update
    ATTR_LOAD_POWER: state.load_power,
AttributeError: 'AirConditioningCompanionStatus' object has no attribute 'load_power'
2018-02-26 23:07:09 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/aiohttp/client.py", line 196, in _request
    url = URL(url)
  File "/usr/lib/python3.6/site-packages/yarl/__init__.py", line 170, in __init__
    val.port,
  File "/usr/lib/python3.6/urllib/parse.py", line 167, in port
    port = int(port, 10)
ValueError: invalid literal for int() with base 10: 'xxxxxx'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 416, in start
    resp = yield from self._request_handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web.py", line 325, in _handle
    resp = yield from handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 93, in impl
    return (yield from handler(request))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/static.py", line 70, in staticresource_middleware
    return (yield from handler(request))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/real_ip.py", line 28, in real_ip_middleware
    return (yield from handler(request))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/ban.py", line 70, in ban_middleware
    return (yield from handler(request))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/auth.py", line 53, in auth_middleware
    return (yield from handler(request))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/__init__.py", line 409, in handle
    result = yield from result
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 944, in get
    data, content_type = yield from player.async_get_media_image()
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 499, in async_get_media_image
    return (yield from _async_fetch_image(self.hass, url))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 901, in _async_fetch_image
    response = yield from websession.get(url)
  File "/usr/lib/python3.6/site-packages/aiohttp/helpers.py", line 104, in __iter__
    ret = yield from self._coro
  File "/usr/lib/python3.6/site-packages/aiohttp/client.py", line 198, in _request
    raise InvalidURL(url)
syssi commented 6 years ago

Could you update python-miio by:

pip3 install -U https://github.com/rytilahti/python-miio/archive/fc5799a05c217be123985f196e71aad57197f11c.zip

The latest revision of python-miio is required.

liorm0505 commented 6 years ago

I think this did not changed the error:

2018-02-26 23:28:53 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2018-02-26 23:28:53 DEBUG (MainThread) [miio.device] Got a response: Container: 
    data = Container: 
        data =  (total 0)
        value =  (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container: 
        data = !1\x00 \x00\x00\x00\x00\x03\xb0\xbf\x95\x00\x0e\x7f\xd3 (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = \x03\xb0\xbf\x95 (total 4)
            ts = 1970-01-11 23:57:07
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (total 16)
2018-02-26 23:28:53 DEBUG (MainThread) [miio.device] Discovered 03b0bf95 with ts: 1970-01-11 23:57:07, token: b'00000000000000000000000000000000'
2018-02-26 23:28:54 DEBUG (MainThread) [miio.device] 192.168.1.26:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
2018-02-26 23:28:54 DEBUG (MainThread) [miio.device] 192.168.1.26:54321 (ts: 1970-01-11 23:57:08, id: 1) << {'result': {'life': 950228, 'token': 'da1e7329c3eaa000b856e8435ea67fed', 'mac': '34:CE:00:C7:78:AD', 'fw_ver': '1.3.0_0033', 'hw_ver': 'ESP8266', 'uid': 1781474662, 'model': 'philips.light.bulb', 'wifi_fw_ver': '1.5.0-dev(7f7a714)', 'ap': {'rssi': -73, 'ssid': 'Lior_Lital_livingroom', 'bssid': '74:DA:38:A3:98:C9'}, 'netif': {'localIp': '192.168.1.26', 'mask': '255.255.255.0', 'gw': '192.168.1.1'}, 'mmfree': 5648}, 'id': 1}
2018-02-26 23:28:55 DEBUG (SyncWorker_14) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2018-02-26 23:28:55 DEBUG (SyncWorker_14) [miio.device] Got a response: Container: 
    data = Container: 
        data =  (total 0)
        value =  (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container: 
        data = !1\x00 \x00\x00\x00\x00\x03\xb0\xbf\x95\x00\x0e\x7f\xd4 (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = \x03\xb0\xbf\x95 (total 4)
            ts = 1970-01-11 23:57:08
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (total 16)
2018-02-26 23:28:55 DEBUG (SyncWorker_14) [miio.device] Discovered 03b0bf95 with ts: 1970-01-11 23:57:08, token: b'00000000000000000000000000000000'
2018-02-26 23:28:55 DEBUG (SyncWorker_14) [miio.device] 192.168.1.26:54321 >>: {'id': 1, 'method': 'get_prop', 'params': ['power', 'bright', 'cct', 'snm', 'dv']}
2018-02-26 23:29:00 ERROR (SyncWorker_14) [miio.device] Got error when receiving: timed out
2018-02-26 23:29:00 WARNING (MainThread) [homeassistant.components.light] Setup of platform xiaomi_miio is taking over 10 seconds.
2018-02-26 23:29:00 WARNING (SyncWorker_14) [miio.device] Retrying with incremented id, retries left: 3
2018-02-26 23:29:00 DEBUG (SyncWorker_14) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2018-02-26 23:29:00 DEBUG (SyncWorker_14) [miio.device] Got a response: Container: 
    data = Container: 
        data =  (total 0)
        value =  (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container: 
        data = !1\x00 \x00\x00\x00\x00\x03\xb0\xbf\x95\x00\x0e\x7f\xda (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = \x03\xb0\xbf\x95 (total 4)
            ts = 1970-01-11 23:57:14
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (total 16)
2018-02-26 23:29:00 DEBUG (SyncWorker_14) [miio.device] Discovered 03b0bf95 with ts: 1970-01-11 23:57:14, token: b'00000000000000000000000000000000'
2018-02-26 23:29:00 DEBUG (SyncWorker_14) [miio.device] 192.168.1.26:54321 >>: {'id': 102, 'method': 'get_prop', 'params': ['power', 'bright', 'cct', 'snm', 'dv']}
2018-02-26 23:29:00 DEBUG (SyncWorker_14) [miio.device] 192.168.1.26:54321 (ts: 1970-01-11 23:57:14, id: 102) << {'result': ['on', 100, 100, 0, 0], 'id': 102}
2018-02-26 23:29:02 DEBUG (SyncWorker_8) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2018-02-26 23:29:02 DEBUG (SyncWorker_8) [miio.device] Got a response: Container: 
    data = Container: 
        data =  (total 0)
        value =  (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container: 
        data = !1\x00 \x00\x00\x00\x00\x03F\xda\xce\x00\r0\xee (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = \x03F\xda\xce (total 4)
            ts = 1970-01-11 00:08:14
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (total 16)
2018-02-26 23:29:02 DEBUG (SyncWorker_8) [miio.device] Discovered 0346dace with ts: 1970-01-11 00:08:14, token: b'00000000000000000000000000000000'
2018-02-26 23:29:02 DEBUG (SyncWorker_8) [miio.device] 192.168.1.44:54321 >>: {'id': 1, 'method': 'get_model_and_state', 'params': []}
2018-02-26 23:29:02 DEBUG (SyncWorker_8) [miio.device] 192.168.1.44:54321 (ts: 1970-01-11 00:08:14, id: 1) << {'result': ['010507950000257301', '010131180100002573', '1'], 'id': 1}
2018-02-26 23:29:02 ERROR (MainThread) [homeassistant.components.climate] xiaomi_miio: Error on device update!
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 197, in _async_add_entity
    yield from entity.async_device_update(warning=False)
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 325, in async_device_update
    yield from self.async_update()
  File "/config/custom_components/climate/xiaomi_miio.py", line 235, in async_update
    ATTR_LOAD_POWER: state.load_power,
AttributeError: 'AirConditioningCompanionStatus' object has no attribute 'load_power'
2018-02-26 23:29:12 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2018-02-26 23:29:16 WARNING (SyncWorker_4) [netdisco.ssdp] Found malformed XML at http://192.168.1.27:49155/description0.xml: 
2018-02-26 23:29:31 DEBUG (SyncWorker_2) [miio.device] 192.168.1.26:54321 >>: {'id': 103, 'method': 'get_prop', 'params': ['power', 'bright', 'cct', 'snm', 'dv']}
2018-02-26 23:29:31 DEBUG (SyncWorker_2) [miio.device] 192.168.1.26:54321 (ts: 1970-01-11 23:57:45, id: 103) << {'result': ['on', 100, 100, 0, 0], 'id': 103}
2018-02-26 23:29:32 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/aiohttp/client.py", line 196, in _request
    url = URL(url)
  File "/usr/lib/python3.6/site-packages/yarl/__init__.py", line 170, in __init__
    val.port,
  File "/usr/lib/python3.6/urllib/parse.py", line 167, in port
    port = int(port, 10)
ValueError: invalid literal for int() with base 10: 'xxxxx'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 416, in start
    resp = yield from self._request_handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web.py", line 325, in _handle
    resp = yield from handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 93, in impl
    return (yield from handler(request))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/static.py", line 70, in staticresource_middleware
    return (yield from handler(request))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/real_ip.py", line 28, in real_ip_middleware
    return (yield from handler(request))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/ban.py", line 70, in ban_middleware
    return (yield from handler(request))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/auth.py", line 53, in auth_middleware
    return (yield from handler(request))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/__init__.py", line 409, in handle
    result = yield from result
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 944, in get
    data, content_type = yield from player.async_get_media_image()
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 499, in async_get_media_image
    return (yield from _async_fetch_image(self.hass, url))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 901, in _async_fetch_image
    response = yield from websession.get(url)
  File "/usr/lib/python3.6/site-packages/aiohttp/helpers.py", line 104, in __iter__
    ret = yield from self._coro
  File "/usr/lib/python3.6/site-packages/aiohttp/client.py", line 198, in _request
    raise InvalidURL(url)
aiohttp.client_exceptions.InvalidURL: http://liorm0505:xxxxx#@192.168.1.5:8080/image/image%3A%2F%2Fhttp%253a%252f%252fimg.mako.co.il%252f2018%252f02%252f25%252fmaster_chef7_31_VOD_b.jpg%2F
2018-02-26 23:30:02 DEBUG (SyncWorker_12) [miio.device] 192.168.1.26:54321 >>: {'id': 104, 'method': 'get_prop', 'params': ['power', 'bright', 'cct', 'snm', 'dv']}
2018-02-26 23:30:02 DEBUG (SyncWorker_12) [miio.device] 192.168.1.26:54321 (ts: 1970-01-11 23:58:16, id: 104) << {'result': ['on', 100, 100, 0, 0], 'id': 104}
2018-02-26 23:30:33 DEBUG (SyncWorker_13) [miio.device] 192.168.1.26:54321 >>: {'id': 105, 'method': 'get_prop', 'params': ['power', 'bright', 'cct', 'snm', 'dv']}
2018-02-26 23:30:33 DEBUG (SyncWorker_13) [miio.device] 192.168.1.26:54321 (ts: 1970-01-11 23:58:47, id: 105) << {'result': ['on', 100, 100, 0, 0], 'id': 105}
2018-02-26 23:31:04 DEBUG (SyncWorker_3) [miio.device] 192.168.1.26:54321 >>: {'id': 106, 'method': 'get_prop', 'params': ['power', 'bright', 'cct', 'snm', 'dv']}

this is the output from the terminal console (just to verify everything was installed correctly):

bash-4.4# pip3 install -U https://github.com/rytilahti/python-miio/archive/fc579                                   9a05c217be123985f196e71aad57197f11c.zip

Collecting https://github.com/rytilahti/python-miio/archive/fc5799a05c217be12398                                   5f196e71aad57197f11c.zip
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connec                                   tion broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.conne                                   ction.VerifiedHTTPSConnection object at 0x75b460b0>: Failed to establish a new c                                   onnection: [Errno -3] Try again',)': /rytilahti/python-miio/archive/fc5799a05c21                                   7be123985f196e71aad57197f11c.zip
  Downloading https://github.com/rytilahti/python-miio/archive/fc5799a05c217be12                                   3985f196e71aad57197f11c.zip
     - 133kB 333kB/s
  Ignoring typing: markers 'python_version < "3.5"' don't match your environment
Collecting construct==2.9.31 (from python-miio==0.3.7)
  Downloading construct-2.9.31.tar.gz (68kB)
    100% |████████████████████████████████| 71kB 231kB/s
Requirement already up-to-date: click in /usr/lib/python3.6/site-packages (from python-miio==0.3.7)
Collecting cryptography (from python-miio==0.3.7)
  Downloading cryptography-2.1.4.tar.gz (441kB)
    100% |████████████████████████████████| 450kB 250kB/s
Requirement already up-to-date: pretty_cron in /usr/lib/python3.6/site-packages (from python-miio==0.3.7)
Collecting zeroconf (from python-miio==0.3.7)
  Downloading zeroconf-0.20.0-py2.py3-none-any.whl
Requirement already up-to-date: attrs in /usr/lib/python3.6/site-packages (from python-miio==0.3.7)
Requirement already up-to-date: android_backup in /usr/lib/python3.6/site-packages (from python-miio==0.3.7)
Requirement already up-to-date: pytz in /usr/lib/python3.6/site-packages (from python-miio==0.3.7)
Requirement already up-to-date: appdirs in /usr/lib/python3.6/site-packages (from python-miio==0.3.7)
Requirement already up-to-date: idna>=2.1 in /usr/lib/python3.6/site-packages (from cryptography->python-miio==0.3.7)
Requirement already up-to-date: asn1crypto>=0.21.0 in /usr/lib/python3.6/site-packages (from cryptography->python-miio==0.3.7)
Requirement already up-to-date: six>=1.4.1 in /usr/lib/python3.6/site-packages (from cryptography->python-miio==0.3.7)
Requirement already up-to-date: cffi>=1.7 in /usr/lib/python3.6/site-packages (from cryptography->python-miio==0.3.7)
Requirement already up-to-date: netifaces!=0.10.5 in /usr/lib/python3.6/site-packages (from zeroconf->python-miio==0.3.7)
Requirement already up-to-date: pycparser in /usr/lib/python3.6/site-packages (from cffi>=1.7->cryptography->python-miio==0.3.7)
Installing collected packages: construct, cryptography, zeroconf, python-miio
  Found existing installation: construct 2.9.34
    Uninstalling construct-2.9.34:
      Successfully uninstalled construct-2.9.34
  Running setup.py install for construct ... done
  Found existing installation: cryptography 2.1.1
    Uninstalling cryptography-2.1.1:
      Successfully uninstalled cryptography-2.1.1
  Running setup.py install for cryptography ... error
    Complete output from command /usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-hhvr5mkb/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-2t5dj9w3-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-3.6
    creating build/lib.linux-armv7l-3.6/cryptography
    copying src/cryptography/fernet.py -> build/lib.linux-armv7l-3.6/cryptography
    copying src/cryptography/__about__.py -> build/lib.linux-armv7l-3.6/cryptography
    copying src/cryptography/utils.py -> build/lib.linux-armv7l-3.6/cryptography
    copying src/cryptography/__init__.py -> build/lib.linux-armv7l-3.6/cryptography
    copying src/cryptography/exceptions.py -> build/lib.linux-armv7l-3.6/cryptography
    creating build/lib.linux-armv7l-3.6/cryptography/x509
    copying src/cryptography/x509/extensions.py -> build/lib.linux-armv7l-3.6/cryptography/x509
    copying src/cryptography/x509/certificate_transparency.py -> build/lib.linux-armv7l-3.6/cryptography/x509
    copying src/cryptography/x509/general_name.py -> build/lib.linux-armv7l-3.6/cryptography/x509
    copying src/cryptography/x509/base.py -> build/lib.linux-armv7l-3.6/cryptography/x509
    copying src/cryptography/x509/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/x509
    copying src/cryptography/x509/name.py -> build/lib.linux-armv7l-3.6/cryptography/x509
    copying src/cryptography/x509/oid.py -> build/lib.linux-armv7l-3.6/cryptography/x509
    creating build/lib.linux-armv7l-3.6/cryptography/hazmat
    copying src/cryptography/hazmat/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat
    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/serialization.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/cmac.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/keywrap.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/mac.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/hmac.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/hashes.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/padding.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/constant_time.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/backends
    copying src/cryptography/hazmat/backends/interfaces.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends
    copying src/cryptography/hazmat/backends/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends
    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings
    copying src/cryptography/hazmat/bindings/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings
    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/ciphers
    copying src/cryptography/hazmat/primitives/ciphers/algorithms.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/ciphers
    copying src/cryptography/hazmat/primitives/ciphers/base.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/ciphers
    copying src/cryptography/hazmat/primitives/ciphers/modes.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/ciphers
    copying src/cryptography/hazmat/primitives/ciphers/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/ciphers
    copying src/cryptography/hazmat/primitives/ciphers/aead.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/ciphers
    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/twofactor
    copying src/cryptography/hazmat/primitives/twofactor/totp.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/twofactor
    copying src/cryptography/hazmat/primitives/twofactor/hotp.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/twofactor
    copying src/cryptography/hazmat/primitives/twofactor/utils.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/twofactor
    copying src/cryptography/hazmat/primitives/twofactor/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/twofactor
    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/rsa.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/dsa.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/dh.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/x25519.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/ec.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/utils.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/padding.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/scrypt.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/hkdf.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/x963kdf.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/kbkdf.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/concatkdf.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/pbkdf2.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/rsa.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/cmac.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/dsa.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/dh.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/decode_asn1.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/hmac.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/ciphers.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/x25519.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/x509.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/encode_asn1.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/ec.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/utils.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/hashes.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/aead.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/backend.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings/openssl
    copying src/cryptography/hazmat/bindings/openssl/_conditional.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings/openssl
    copying src/cryptography/hazmat/bindings/openssl/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings/openssl
    copying src/cryptography/hazmat/bindings/openssl/binding.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings/openssl
    running egg_info
    writing src/cryptography.egg-info/PKG-INFO
    writing dependency_links to src/cryptography.egg-info/dependency_links.txt
    writing requirements to src/cryptography.egg-info/requires.txt
    writing top-level names to src/cryptography.egg-info/top_level.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'src/cryptography.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    no previously-included directories found matching 'docs/_build'
    warning: no previously-included files matching '*' found under directory 'vectors'
    writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
    running build_ext
    generating cffi module 'build/temp.linux-armv7l-3.6/_padding.c'
    creating build/temp.linux-armv7l-3.6
    generating cffi module 'build/temp.linux-armv7l-3.6/_constant_time.c'
    generating cffi module 'build/temp.linux-armv7l-3.6/_openssl.c'
    building '_openssl' extension
    creating build/temp.linux-armv7l-3.6/build
    creating build/temp.linux-armv7l-3.6/build/temp.linux-armv7l-3.6
    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.6m -c build/temp.linux-armv7l-3.6/_openssl.c -o build/temp.linux-armv7l-3.6/build/temp.linux-armv7l-3.6/_openssl.o -Wconversion -Wno-error=sign-conversion
    unable to execute 'gcc': No such file or directory
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
  Rolling back uninstall of cryptography
Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-hhvr5mkb/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-2t5dj9w3-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-hhvr5mkb/cryptography/
syssi commented 6 years ago
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.6m -c build/temp.linux-armv7l-3.6/_openssl.c -o build/temp.linux-armv7l-3.6/build/temp.linux-armv7l-3.6/_openssl.o -Wconversion -Wno-error=sign-conversion
    unable to execute 'gcc': No such file or directory
    error: command 'gcc' failed with exit status 1

This didn't end up fine. There is no "gcc" installed?! Please install

apt-get install libffi-dev libssl-dev

pip3 install -U setuptools
# In case you get an error similar like ImportError: No module named 'packaging' during the installation, you need to upgrade pip and setuptools:
pip3 install -U pip setuptools
# And try again
pip3 install -U https://github.com/rytilahti/python-miio/archive/fc5799a05c217be123985f196e71aad57197f11c.zip
liorm0505 commented 6 years ago

I think that didn't went well....

bash-4.4# apt-get install libffi-dev libssl-dev
bash: apt-get: command not found

pip install went smooth:

bash-4.4# pip3 install -U setuptools
Collecting setuptools
  Downloading setuptools-38.5.1-py2.py3-none-any.whl (489kB)
    100% |████████████████████████████████| 491kB 233kB/s
Installing collected packages: setuptools
  Found existing installation: setuptools 28.8.0
    Uninstalling setuptools-28.8.0:
      Successfully uninstalled setuptools-28.8.0
Successfully installed setuptools-38.5.1

FYI - i am executing these commands inside the container. I that correct?

bon9it commented 6 years ago

At startup

2018-02-27 23:44:44 ERROR (MainThread) [homeassistant.components.climate] xiaomi_miio: Error on device update!
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 197, in _async_add_entity
    yield from entity.async_device_update(warning=False)
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 325, in async_device_update
    yield from self.async_update()
  File "/config/custom_components/climate/xiaomi_miio.py", line 235, in async_update
    ATTR_LOAD_POWER: state.load_power,
AttributeError: 'AirConditioningCompanionStatus' object has no attribute 'load_power'
syssi commented 6 years ago

The development version of python-miio is required currently. Sorry!

syssi commented 6 years ago

Please install

pip3 install -U https://github.com/rytilahti/python-miio/archive/master.zip
syssi commented 6 years ago

@liorm0505 It's not easy to install development version at hassio. A build process is used to provide your full featured image. I cannot/want encourage you to use hassio as a development machine.

liorm0505 commented 6 years ago

Well, I tried using your last command and it still screaming something about missing components you just mentioned before. I sense there is a limitation here since i am using hassio instead of regular build. Thanks for trying anyways.

PS - when the required python package will be official i will be happy if you could notify me.

BTW, If you want to test access to switches that are currently connected to the hub we can do that.
I am still open for further testing and research. I know this work will lead one day to a working component.

syssi commented 6 years ago

I ordered the device today to speed up the development! ;-)

liorm0505 commented 6 years ago

Great !

liorm0505 commented 6 years ago

Hi,

I have noticed you updated the code not so long ago. Is it possible for me to use the component now or does it still require dependencies that my system do not support?

syssi commented 6 years ago

python-miio (the required dependency) will be released this weekend. It's your turn hereupon.

liorm0505 commented 6 years ago

Hi,

After updating to your latest version (with requirements update) i get the following error:

2018-03-10 21:12:56 ERROR (SyncWorker_17) [homeassistant.util.package] Unable to install package python-miio>=0.3.8: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-_y3kqrj4/cffi/
2018-03-10 21:12:56 ERROR (MainThread) [homeassistant.requirements] Not initializing climate.xiaomi_miio because could not install requirement python-miio>=0.3.8
2018-03-10 21:12:56 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform climate.xiaomi_miio: Could not install all requirements.
syssi commented 6 years ago

Do you own more xiaomi devices / components?

liorm0505 commented 6 years ago

I have an Aqara wireless switch (double) connected to the hub and a Yeelight bulb. I do own a presence detector and another aqara switch (single) which i currently do not use (but we can use them for testing ).

syssi commented 6 years ago

Okay, just aqara (zigbee) components. No wifi?

liorm0505 commented 6 years ago

Yeelight is wifi.

syssi commented 6 years ago

Okay the problem is hassio again. Please wait for homeassistant 0.66. It will include all needed requirements.:-(