Daikin Skyfi and 0.111.0 - first time use - no zones detected

FYI it is working perfectly for me at version: Home Assistant 0.111.0

1 Like

oh cool. Skyfi? If so, what zones do you have - would be nice to pass your zones response thru the above new code to confirm no breaking change for you there too.

I’m still looking to see if I can figure out how to get under the hood at all to replace files. Not sure it’ll be a quick thing for me to be able to test this

My zones are separate, manual push-button controller.

1 Like

OK, in case the fix that made it to 0.111.4 was meant to address this (I really don’t know if it was) then it didn’t address it (on my already-configured integration).

2020-06-18 11:45:19 ERROR (MainThread) [homeassistant.components.switch] Error while setting up daikin platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/src/homeassistant/homeassistant/components/daikin/switch.py", line 24, in async_setup_entry
    zones = daikin_api.device.zones
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_skyfi.py", line 158, in zones
    for i, onoff in enumerate(self.represent('zone')[1])
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_skyfi.py", line 121, in represent
    val = str(bin(int(self[key]) + 256))[3:][int(self['nz'])]
IndexError: string index out of range

That one happened immediately after the .4 update finished applying, followed by:

2020-06-18 11:49:28 DEBUG (MainThread) [pydaikin.daikin_skyfi] Parsing opmode=0&units=.&settemp=23.0&fanspeed=3&fanflags=1&acmode=2&tonact=0&toffact=0&prog=0&time=11:51&day=3&roomtemp=22&outsidetemp=17&louvre=0&zone=192&flt=0&test=0&errdata=144&sensors=1
2020-06-18 11:49:29 DEBUG (MainThread) [pydaikin.daikin_skyfi] Parsing nz=8&zone1=Living%20area&zone2=Front%20living&zone3=Bedrooms&zone4=Zone%204&zone5=Zone%205&zone6=Zone%206&zone7=Zone%207&zone8=Zone%208
2020-06-18 11:50:28 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi?pass={}', 'zones.cgi?pass={}']
2020-06-18 11:50:31 DEBUG (MainThread) [pydaikin.daikin_skyfi] ClientResponseError("400, message='invalid constant string', url='http://192.168.3.0:2000/ac.cgi?pass=12345") #0

I still haven’t got direct SSH access to the docker base, to test out replacing the file as per above. I’m a Windows user and have not managed to figure out reliably how to get SSH keys loaded and a service running as per https://developers.home-assistant.io/docs/operating-system/debugging/ but haven’t had too much time to look further.

Hi Team - great work on this plugin.

Have it working for the base functions but the zone switching isn’t appearing. Found this in the logs.

Traceback (most recent call last):

  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/src/homeassistant/homeassistant/components/daikin/switch.py", line 24, in async_setup_entry
    zones = daikin_api.device.zones
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_skyfi.py", line 158, in zones
    for i, onoff in enumerate(self.represent('zone')[1])
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_skyfi.py", line 121, in represent
    val = str(bin(int(self[key]) + 256))[3:][int(self['nz'])]
IndexError: string index out of range

Extra details
Home Assistant 0.111.4
I know the URL (setzone.cgi?pass=XXXX&z=1&s=0)
Zone names = Zone 1 , Zone 2 (i had them as custom names previously which didn’t work either)

Any suggestions ?

Thanks
Andrew

Hi Andrew,
that’s the same bug that this thread is about - there’s an impending fix but I can’t test it to confirm that it’s fixed. Are you using this on a RPi (or other HASS OS + Docker ) build, or do you have access to replace underlying code to test the fix?

Ok great - good to see I’m in the right place :slight_smile:

I am using HASS OS on Rpi , but easy enough for me to spin up an instance on another Pi or Docker to test - do you have a quick guide of what needs to be done?

1 Like

Just this from @fredrike from earlier in this thread: Daikin Skyfi and 0.111.0 - first time use - no zones detected

Hopefully that puts you in a good place.

My linux and docker fu is pretty much non-existent so that’s why I haven’t cracked how best to test this. My GIT fu is equally deficient to know whether the above bitbucket chunk has made it into a release (I think 0.112 is dropping in the next 24 hours)

I just spun up a new https://hub.docker.com/r/homeassistant/home-assistant/ and it is on 0.111.1 , and the zones appear no problems.

My hass.io build is 0.111.4 and its broken there. Looks like i’ll have to dig out a Pi and try on 0.111.4

1 Like

OK, so run up a https://hub.docker.com/r/homeassistant/home-assistant/

set the version in compose to 0.111.4

Zones have dissappeared when moving to 0.111.4

version: '3'
services:
  homeassistant:
    container_name: home-assistant
    image: homeassistant/home-assistant:0.111.4
    volumes:
      - ./config/:/config
    environment:
      - TZ=Australia/Sydney
    restart: always
    network_mode: host

ran docker-compose up -d

serveradmin@dockerbox-dev01:~/riley-container-dev/docker-hass$ docker logs home-assistant 
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] udev.sh: executing... 
starting version 3.2.9
[17:24:17] INFO: Update udev information
[cont-init.d] udev.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
2020-06-30 17:24:29 ERROR (MainThread) [homeassistant.components.switch] Error while setting up daikin platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/src/homeassistant/homeassistant/components/daikin/switch.py", line 24, in async_setup_entry
    zones = daikin_api.device.zones
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_skyfi.py", line 158, in zones
    for i, onoff in enumerate(self.represent('zone')[1])
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_skyfi.py", line 121, in represent
    val = str(bin(int(self[key]) + 256))[3:][int(self['nz'])]
IndexError: string index out of range

Will retest shortly just to make sure I didn’t miss something.

1 Like

Applied the fix https://bitbucket.org/mustang51/pydaikin/src/skyfi_zones/pydaikin/daikin_skyfi.py

to 0.111.4 (docker image) and now the zones are showing.

New problem: If I try to toggle a zone the slider moves but goes back to the off position.

2020-06-30 17:24:29 ERROR (MainThread) [homeassistant.components.switch] Error while setting up daikin platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/src/homeassistant/homeassistant/components/daikin/switch.py", line 24, in async_setup_entry
    zones = daikin_api.device.zones
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_skyfi.py", line 158, in zones
    for i, onoff in enumerate(self.represent('zone')[1])
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_skyfi.py", line 121, in represent
    val = str(bin(int(self[key]) + 256))[3:][int(self['nz'])]
IndexError: string index out of range

Thoughts; i’m not that clever when it comes to the code :slight_smile:

1 Like

Again given my lack of knowledge, I could be waaaay off, but the above docker-compose should put 0.111.4 on, and that has the bug (and your string index out of range confirms it). Why 0.111.1 works on your earlier post I can’t be sure, this seems to be the PR for 0.111.1 https://github.com/home-assistant/core/pull/36571. I can’t recall it working on mine (I suffered from the problem of enrolling prior to 0.111.0, where there was a different error, fixed in this PR https://github.com/home-assistant/core/pull/35768 but can’t seem to put my finger on a bug report describing it - but basically it wouldn’t parse the URI correctly on the SkyFi controller and you couldn’t configure the integration at all)

Edit: while I was typing and finding links, you posted the 111.4+update test. Nice, some parts at least work ! :slight_smile:

The same error is appearing in the same line (line 121) so there’s a parsing that might also need to be checked. I’ll take a look at the code change to see if I can see anything (I’m not that familiar with it either), but just a comment on the switch behaviours… if HA runs like the skyfi app, the UI takes your switch change, submits it to the web server on the Daikin controller, and then it re-polls to see the updated zone list. Perhaps the UI in HA is simply redrawing based on state and the re-poll hasn’t yet shown the changed state?

Here’s an error log i get when trying the zone switch

Logger: homeassistant.helpers.entity
Source: components/daikin/__init__.py:146
First occurred: 19:22:15 (1 occurrences)
Last logged: 19:22:15

Update for switch.daikin_ac_zone_1 fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 847, in start
    message, payload = await self._protocol.read()  # type: ignore  # noqa
  File "/usr/local/lib/python3.7/site-packages/aiohttp/streams.py", line 591, in read
    await self._waiter
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_proto.py", line 199, in data_received
    messages, upgraded, tail = self._parser.feed_data(data)
  File "aiohttp\_http_parser.pyx", line 523, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadHttpMessage: 400, message='invalid constant string'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 470, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/daikin/switch.py", line 70, in async_update
    await self._api.async_update()
  File "/usr/src/homeassistant/homeassistant/components/daikin/__init__.py", line 146, in async_update
    await self.device.update_status()
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_base.py", line 209, in update_status
    self.values.update(await self._get_resource(resource))
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_base.py", line 192, in _get_resource
    return await self._get_resource(resource, retries=retries - 1)
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_base.py", line 192, in _get_resource
    return await self._get_resource(resource, retries=retries - 1)
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_base.py", line 185, in _get_resource
    return await self._run_get_resource(resource)
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_skyfi.py", line 106, in _run_get_resource
    return await super()._run_get_resource(resource)
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_base.py", line 196, in _run_get_resource
    async with self.session.get(f'http://{self._device_ip}/{resource}') as resp:
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 504, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 852, in start
    message=exc.message, headers=exc.headers) from exc
aiohttp.client_exceptions.ClientResponseError: 400, message='invalid constant string', url='http://10.54.5.104:2000/ac.cgi?pass=XXXX

Edit: While i’ve got this error, after a few more rounds of clicking the switches a few have got through and are switching the zones (verified by watching the controller on the wall and the skyfi app on my phone)

can I ask, was there a complete URL in that very last string, where you removed the password, or did it just end with the password? The forum seems to have truncated it as I’d at least expect a closing quote.

BTW, good to see someone else in SYD here.

I suspect that closing quote could have just been when I did the password clean up. My container had shut down so I’ve lost the logs for that test. Have just got it running again so will keep any eye out for that same error.

I am seeing two other errors now which i suspect could just be the rather average Skyfi http service.
#sidetopic - is it time to look at a new interface to the daikin ?

2020-07-01 08:45:45 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.139816899245904] [Errno 104] Connection reset by peer
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1295, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 454, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 597, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 485, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/daikin/switch.py", line 74, in async_turn_on
    await self._api.device.set_zone(self._zone_id, "1")
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_skyfi.py", line 170, in set_zone
    current_state = await self._get_resource(query)
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_base.py", line 185, in _get_resource
    return await self._run_get_resource(resource)
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_skyfi.py", line 106, in _run_get_resource
    return await super()._run_get_resource(resource)
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_base.py", line 196, in _run_get_resource
    async with self.session.get(f'http://{self._device_ip}/{resource}') as resp:
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 504, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 847, in start
    message, payload = await self._protocol.read()  # type: ignore  # noqa
  File "/usr/local/lib/python3.7/site-packages/aiohttp/streams.py", line 591, in read
    await self._waiter
aiohttp.client_exceptions.ClientOSError: [Errno 104] Connection reset by peer
2020-07-01 08:52:17 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall switch.turn_on (c:89a66c9ec8cc4a659ebc410d997f97c0): entity_id=['switch.daikin_ac_zone_2']>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1276, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1295, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 454, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 597, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 485, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/daikin/switch.py", line 74, in async_turn_on
    await self._api.device.set_zone(self._zone_id, "1")
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_skyfi.py", line 170, in set_zone
    current_state = await self._get_resource(query)
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_base.py", line 185, in _get_resource
    return await self._run_get_resource(resource)
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_skyfi.py", line 106, in _run_get_resource
    return await super()._run_get_resource(resource)
  File "/usr/local/lib/python3.7/site-packages/pydaikin/daikin_base.py", line 196, in _run_get_resource
    async with self.session.get(f'http://{self._device_ip}/{resource}') as resp:
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 504, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 860, in start
    self._continue = None
  File "/usr/local/lib/python3.7/site-packages/aiohttp/helpers.py", line 586, in __exit__
    raise asyncio.TimeoutError from None
concurrent.futures._base.TimeoutError

Edit: Awesome, figured i wasn’t alone tinkering with this stuff here in Syd.

1 Like

Sigh. Well I always prefer a vendor supported product, and this one seemed to hold promise; and to be honest it’s been pretty reliable when just using the SkyFi app and that’s it. It was being used in our place only half a dozen times a day, max, and it hardly missed a beat while we’ve had it (installed 2016). Fast forward, and the fact that this integration polls “fast”, and constantly, is possibly showing the limitations of the web server and dodgy response(s) we see. I regularly get the timeout messages like below

Update of sensor.daikin_ac_inside_temperature is taking over 10 seconds
10:28:55 AM – __main__.py (WARNING) - message first occurred at 7:53:28 AM and shows up 48 times

So anyone know what the (electrical) interface between the current skyfi unit and the controller is? If so, some electronics can fix that and a REST implementation isn’t inconceivable. Probably a whirlpool topic rather than a HA one :slight_smile:

So the update seems to have made it into 0.112.0. I can now see the switches as well. There’s quirks and errors but I want it to be in for a day or more before I comment in any detail.

I do still see these often:

Logger: homeassistant.helpers.entity
Source: __main__.py:356
First occurred: 10:28:40 AM (38 occurrences)
Last logged: 11:52:03 AM

Update of sensor.daikin_ac_inside_temperature is taking over 10 seconds
Update of climate.daikin_ac is taking over 10 seconds

and this one less often:

Logger: homeassistant.components.climate
Source: helpers/entity_platform.py:544
Integration: Climate (documentation, issues)
First occurred: 10:48:52 AM (4 occurrences)
Last logged: 10:51:55 AM

Updating daikin climate took longer than the scheduled update interval 0:01:00

which to me suggests maybe we are overloading the webserver. I wonder has anyone else seen this, and whether setting a less aggressive refresh time might help (should that be a configuration item?)

Its the best ive seen it work so far for me.

I get the sensor update errors as usual but now all the zones show up properly.

The zones reflect the correct status ( ON/OFF ) but the switch itself does not work.

1 Like

So can you confirm what version you’re running, and then be very clear on what you mean about the zone switches? I haven’t had the heating on today since upgrade so I can’t confirm, but it looks like, from the dashboard, that the switches are detected fine and read the correct value from the unit (it matches what I see in the skyfi app on my phone) so its reading the values correctly… what I think you’re hinting at is that you can’t then SET or UN-SET a zone through the toggle on the lovelace pane?
daikin
So for example when I turn the AC on I shouldn’t expect to be able to turn on the zones as per the list in that screenshot…

(remember, this is the first time I’m seeing this integration at all) What I also thought was interesting was that this group of switches had a switch on it too, at the top right… I don’t really understand what it was/might be used for, or how it came about since there isn’t an additional switch listed in entities, just the 8 for the 8 zones (in my case, 3 named ones and 5 remaining unaltered for zone4-8)