home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.18k stars 30.21k forks source link

Vimar Dimmer 14595 Homekit Issue No adjustment #101554

Closed delli87 closed 6 days ago

delli87 commented 1 year ago

The problem

I use the Vimar 14595 connected dimmer. When I try to adjust the brightness, the dimmer receives the command and dims the light. But after about a second it directly resets to 100%

What version of Home Assistant Core has the issue?

2023.10.0

What was the last working version of Home Assistant Core?

Nothing

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Homekit

Link to integration documentation on our website

https://www.home-assistant.io/integrations/homekit_controller/

Diagnostics information

error_log-8.txt #

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @jc2k, @bdraco, mind taking a look at this issue as it has been labeled with an integration (homekit_controller) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `homekit_controller` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign homekit_controller` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


homekit_controller documentation homekit_controller source (message by IssueLinks)

Jc2k commented 1 year ago

It looks like the device accepts the request to change the brightness to 36% but then a moment later changing its mind, it flips back to 100% And sends an event to tell HA.

Can you set it to 5%? 10%? 50%?

delli87 commented 1 year ago

Yes, I can do, it but the problem arises again. The light also dims for a moment and then rises again to maximum

Il sab 7 ott 2023, 10:27 Jc2k @.***> ha scritto:

It looks like the device accepts the request to change the brightness to 1% but then a moment later changing its mind, it flips back to 100% And sends an event to tell HA.

Can you set it to 5%? 10%? 50%?

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/101554#issuecomment-1751649757, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQD2RQO6MW25ACNZJOSHQB3X6EG5ZAVCNFSM6AAAAAA5WIQKXKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJRGY2DSNZVG4 . You are receiving this because you authored the thread.Message ID: @.***>

Jc2k commented 1 year ago

Does the brightness actually change, either for a moment or correctly?

delli87 commented 1 year ago

Changes for a moment, then returns to 100%

Jc2k commented 1 year ago

It looks like we set the brightness and then turn it on. Best guess - when your device gets the "turn it on" command it's changing the brightness to 100%. But it would be the first device we've seen to do so (and we have lots of other devices that do work). Will see if I can grab what iOS does in this case.

delli87 commented 11 months ago

It looks like we set the brightness and then turn it on. Best guess - when your device gets the "turn it on" command it's changing the brightness to 100%. But it would be the first device we've seen to do so (and we have lots of other devices that do work). Will see if I can grab what iOS does in this case.

I tried using Homekit by associating the Vimar gateway directly on IOS. Works well The issue is present only on Homekit home assistant.

tklajnscek commented 10 months ago

Same issue here! It takes the command, then resets to 100% a few moments later.

I'm a programmer so if you can point me in the direction of what's the easiest way to maybe comment out the turn-on command I can try it...

Edit: I'm hoping I can edit some files and push then to my PI and not have to do the full HA dev setup and all :)

Jc2k commented 10 months ago

Start of by getting the logs for aiohomekit. Verify that you see a PUT when you make a change. You should see it write to a pair of numbers - the aid and iid. Then you should see an event for that aid and iid with the old value. Then you might see GET requests for that aid/if that contain that value.

Those logs will contain the raw requests made to the device, the events it sends of its own accord and then polls we intermittently make to verify we didn't miss an event.

From what I remember, the device accepts the change (no error) but then reverts it by itself.

If you can recreate that log yourself first, then we can go from there.

Jc2k commented 10 months ago

(You'll also need to figure out how to edit files in the ha container yourself)

tklajnscek commented 10 months ago

Will do in the morning and post back here! Thanks!

tklajnscek commented 10 months ago

Huh... so I noticed that after the recent updates (I don't know which, it all updates automatically) the homekit device doesn't startup correctly anymore. It fails while initializing the gateway with:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/homekit_controller/__init__.py", line 44, in async_setup_entry
    await conn.async_setup()
  File "/usr/src/homeassistant/homeassistant/components/homekit_controller/connection.py", line 303, in async_setup
    self.async_set_available_state(self.pairing.is_available)
  File "/usr/src/homeassistant/homeassistant/components/homekit_controller/connection.py", line 224, in async_set_available_state
    callback_()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 843, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 786, in _async_generate_attributes
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/cover/__init__.py", line 287, in state_attributes
    if (current_tilt := self.current_cover_tilt_position) is not None:
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/homekit_controller/cover.py", line 223, in current_cover_tilt_position
    tilt_position = int(tilt_position / scale)
                        ~~~~~~~~~~~~~~^~~~~~~
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'
codyc1515 commented 10 months ago

Huh... so I noticed that after the recent updates (I don't know which, it all updates automatically) the homekit device doesn't startup correctly anymore. It fails while initializing the gateway with:

This doesn't look related, please raise a new issue.

Jc2k commented 10 months ago

There's an existing issue for that one. Don't have the number to hand, but it's related to a Pr back in July iirc. The author was looking into it but it was a bit intermittent.

delli87 commented 8 months ago

Is there any news?

tklajnscek commented 8 months ago

Hey, I've been busy with life 😅

I did manage to fix two things:

  1. The lights not taking brightness changes is fixed by splitting it into two commands - one for turn on and the other one that just sets the brightness
  2. I also fixed the issue I mentioned above where the HomeKit itegration fails to startup after the rolling shutter tilt unit fix.

I was in the process of fixing the last remaining issue which is that the shutter tilt is inverted for my Vimar IoT rolling shutter switches (same series as the dimmer). Whoever did the tilt arcdegrees fix made too many assumptions :)

I have all these changes live in my HA deployment done via the VSCode addon directly on my RPI 🤭 , but I am yet to clean it up and put up a PR. Will do it some time next month.

lorenzgira commented 6 months ago

Hey, I've been busy with life 😅

I did manage to fix two things:

  1. The lights not taking brightness changes is fixed by splitting it into two commands - one for turn on and the other one that just sets the brightness
  2. I also fixed the issue I mentioned above where the HomeKit itegration fails to startup after the rolling shutter tilt unit fix.

I was in the process of fixing the last remaining issue which is that the shutter tilt is inverted for my Vimar IoT rolling shutter switches (same series as the dimmer). Whoever did the tilt arcdegrees fix made too many assumptions :)

I have all these changes live in my HA deployment done via the VSCode addon directly on my RPI 🤭 , but I am yet to clean it up and put up a PR. Will do it some time next month.

Hi @tklajnscek, i've the same problem with the Vimar 30805 connected dimmer. How did you solve the problem number 1? How can I split the regulation of brightness into two commands? Thank you very much 😁

delli87 commented 5 months ago

Hi, any updates?

tklajnscek commented 4 months ago

Wow, I'm so sorry, but this totally dropped off my radar!

I actually ended up switching all my dimmers and shutter switches to Zigbee mode and:

The only downside is you can't customize the switch LED color/brightness and the setup is incredibly tedious because you can't use the app but have to go through the physical switches to setup the min/max ranges etc.

@lorenzgira - in case you're still interested - in homekit_controller/light.py I changed async_turn_on to this:

async def async_turn_on(self, **kwargs: Any) -> None:
        """Turn the specified light on."""
        hs_color = kwargs.get(ATTR_HS_COLOR)
        temperature = kwargs.get(ATTR_COLOR_TEMP)
        brightness = kwargs.get(ATTR_BRIGHTNESS)

        if not self.is_on:
            characteristics = {}
            characteristics[CharacteristicsTypes.ON] = True

            await self.async_put_characteristics(characteristics)

        characteristics = {}

        if hs_color is not None:
            characteristics.update(
                {
                    CharacteristicsTypes.HUE: hs_color[0],
                    CharacteristicsTypes.SATURATION: hs_color[1],
                }
            )
        if brightness is not None:
            characteristics[CharacteristicsTypes.BRIGHTNESS] = int(
                brightness * 100 / 255
            )
        if temperature is not None:
            characteristics[CharacteristicsTypes.COLOR_TEMPERATURE] = int(temperature)

        if characteristics: 
            await self.async_put_characteristics(characteristics)

Which 1st turns the light on, then sends the color/brightness data separately. This works, but it's not super reliable - it's very laggy sometimes.

delli87 commented 4 months ago

Wow, mi dispiace tanto, ma questo è completamente scomparso dal mio radar!

In realtà ho finito per impostare tutti i miei dimmer e gli interruttori dell'otturatore in modalità Zigbee e:

  • è notevolmente meno lento e più coerente
  • Ho solo le reti wifi e zigbee sulla banda 2.4ghz invece di tre (la rete bluetooth)
  • Non devo occuparmi di servizi cloud e app Vimar

L'unico lato negativo è che non puoi personalizzare il colore/luminosità del LED dell'interruttore e la configurazione è incredibilmente noiosa perché non puoi utilizzare l'app ma devi passare attraverso gli interruttori fisici per impostare le gamme min/max, ecc.

@lorenzgira- nel caso fossi ancora interessato - homekit_controller/light.pyho cambiato async_turn_onin questo:

async def async_turn_on(self, **kwargs: Any) -> None:
        """Turn the specified light on."""
        hs_color = kwargs.get(ATTR_HS_COLOR)
        temperature = kwargs.get(ATTR_COLOR_TEMP)
        brightness = kwargs.get(ATTR_BRIGHTNESS)

        if not self.is_on:
            characteristics = {}
            characteristics[CharacteristicsTypes.ON] = True

            await self.async_put_characteristics(characteristics)

        characteristics = {}

        if hs_color is not None:
            characteristics.update(
                {
                    CharacteristicsTypes.HUE: hs_color[0],
                    CharacteristicsTypes.SATURATION: hs_color[1],
                }
            )
        if brightness is not None:
            characteristics[CharacteristicsTypes.BRIGHTNESS] = int(
                brightness * 100 / 255
            )
        if temperature is not None:
            characteristics[CharacteristicsTypes.COLOR_TEMPERATURE] = int(temperature)

        if characteristics: 
            await self.async_put_characteristics(characteristics)

Quale prima accende la luce, quindi invia i dati di colore/luminosità separatamente. Funziona, ma non è molto affidabile: a volte è molto lento.

Sorry, I'm not very practical. In which file should I insert this configuration?

lorenzgira commented 4 months ago

Wow, I'm so sorry, but this totally dropped off my radar!

I actually ended up switching all my dimmers and shutter switches to Zigbee mode and:

  • it's quite noticably less laggy and more consistent
  • I only have the wifi and zigbee networks on the 2.4ghz band instead of three (the bluetooth network)
  • I don't have to deal with any Vimar cloud services and apps

The only downside is you can't customize the switch LED color/brightness and the setup is incredibly tedious because you can't use the app but have to go through the physical switches to setup the min/max ranges etc.

@lorenzgira - in case you're still interested - in homekit_controller/light.py I changed async_turn_on to this:

async def async_turn_on(self, **kwargs: Any) -> None:
        """Turn the specified light on."""
        hs_color = kwargs.get(ATTR_HS_COLOR)
        temperature = kwargs.get(ATTR_COLOR_TEMP)
        brightness = kwargs.get(ATTR_BRIGHTNESS)

        if not self.is_on:
            characteristics = {}
            characteristics[CharacteristicsTypes.ON] = True

            await self.async_put_characteristics(characteristics)

        characteristics = {}

        if hs_color is not None:
            characteristics.update(
                {
                    CharacteristicsTypes.HUE: hs_color[0],
                    CharacteristicsTypes.SATURATION: hs_color[1],
                }
            )
        if brightness is not None:
            characteristics[CharacteristicsTypes.BRIGHTNESS] = int(
                brightness * 100 / 255
            )
        if temperature is not None:
            characteristics[CharacteristicsTypes.COLOR_TEMPERATURE] = int(temperature)

        if characteristics: 
            await self.async_put_characteristics(characteristics)

Which 1st turns the light on, then sends the color/brightness data separately. This works, but it's not super reliable - it's very laggy sometimes.

Thank you so much! I’ll try the next week to add this configuration. Thanks a lot:)

delli87 commented 3 months ago

@lorenzgira Were you able to add the configuration?

issue-triage-workflows[bot] commented 1 week ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.