Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support transitionTime where applicable (e.g. transition) #28

Closed
stefan-schweiger opened this issue Jun 17, 2024 · 20 comments
Closed

Support transitionTime where applicable (e.g. transition) #28

stefan-schweiger opened this issue Jun 17, 2024 · 20 comments

Comments

@stefan-schweiger
Copy link

stefan-schweiger commented Jun 17, 2024

Most (if not all) zigbee2mqtt light devices support a duration/transition time for controlling the dim level and sometimes also color.

As far as I can tell this currently is not exposed / passed through with this plugin. Would be great to have this ability where it applies.

Here is the corresponding definition in matter.js:

@Luligu
Copy link
Owner

Luligu commented Jun 17, 2024

Hi,
I agree with you 100 %.
The problem here unfortunately is not what we could do in the plugin, but what we con do right now with the actual versions of the controllers.
There is no controller that send appropriate commands for the duration and transition so there is nothing we can do now.
We are still in a situation where all controllers support (not even completely) Matter 1.1.
The Matter 1.3 specs added a lot of new devices that I would love to see in the controllers and of course add to z2m plugin too...
but we have to wait.
Just to make you an example, Matterbridge had the Air Quality device ready since October last year. I had to wait 8 month before seeing it in a controller (HA in this case).
All common use new Matter 1.3 devices are already added to Matterbridge but no controllers support them...
If you have found a controller that support more let me know... I will be happier then you to add some new devices and more control over the supported clusters.
Same problem applies to shelly plugin that I'm releasing now. The devices have a lot of functionalities that I cannot use cause the controllers don't support more then On Off Level Color.

@stefan-schweiger
Copy link
Author

stefan-schweiger commented Jun 17, 2024

Thank you very much for that detailed explanation. Since I'm not running home assistant myself I don't have too much insight how their controller works, but just from a quick glance at the HA code shouldn't this send the command with the transition time? Or do you mean the actual UI/automations don't support it?

EDIT: here is the corresponding issue home-assistant/core#109803

@Luligu
Copy link
Owner

Luligu commented Jun 17, 2024

{
level: 130,
transitionTime: 2,
optionsMask: { executeIfOff: false, coupleColorTempToLevel: false },
optionsOverride: { executeIfOff: false, coupleColorTempToLevel: false }
}
This is how the command moveToLevelWithOnOff is sent to our devices from ha.
You have no option to set the transition in the ha ui.
image

@stefan-schweiger
Copy link
Author

stefan-schweiger commented Jun 17, 2024

It seems a bit weird to me that apparently they just always send transitionTime: 2 in your setup. But what I can gather from the HA documentation (search for transition) it seems like you can either configure a default value for all lights through profiles or use it through automations. For example to create a wakeup light which gets gradually brighter for a duration of like 30 minutes.

@stefan-schweiger
Copy link
Author

stefan-schweiger commented Jun 17, 2024

Just set up HA real quick and configured a automation to move the brightness to 80 within 10 seconds and this is what I see in the matterbridge logs:

Invoke moveToLevelWithOnOff with data {"level":80,"transitionTime":100,"optionsMask":{"executeIfOff":false,"coupleColorTempToLevel":false},"optionsOverride":{"executeIfOff":false,"coupleColorTempToLevel":false}}

So I think HA does handle this correctly.

EDIT: Automation used:

alias: New Automation
description: ""
trigger:
  - platform: webhook
    allowed_methods:
      - POST
      - PUT
      - GET
    local_only: true
    webhook_id: "<my_webhook_id>"
condition: []
action:
  - service: light.turn_on
    target:
      entity_id: <my_entity_id>
    metadata: {}
    data:
      brightness: 80
      transition: 10
mode: single

@Luligu
Copy link
Owner

Luligu commented Jun 18, 2024

Hi,
is done.

Are you available to test it on your setup before I publish?

[2.0.18] - 2024-06-17

Added

  • [dependencies]: Update dependencies
  • [schema]: Added schema to the root directory of the plugin
  • [properties]: Added soil_moisture properties as humidity sensor
  • [properties]: Added transition if the zigbee device supports it and the controller sends it. You can disable this globally adding transition to the featureBlackList or only for the single device adding transition to the deviceFeatureBlackList.

Fixed

  • [schema]: Username and password are no more required fields
  • [LevelControl]: Fixed the commandHandler for LevelControl in child endpoint.
Buy me a coffee

@stefan-schweiger
Copy link
Author

Sure, what's the best way to try out some "prerelease" when running matterbridge in a docker container? Just manually building it on my system and copy the results over in the Matterbridge/matterbridge-zigbee2mqtt folder?

@Luligu
Copy link
Owner

Luligu commented Jun 18, 2024

I guess you are expert so I usually do this way with my collaborators that use docker:

  • copy the .tgz file in Matterbridge directory (the mapped directory outside the container)
  • open a bash shell on the container: docker exec -it matterbridge /bin/bash
  • then from the shell: npm -g install ~/Matterbridge/*.tgz

This always work but for sure there are other methods...

matterbridge-zigbee2mqtt-2.0.18.zip

Let me know if you need more help.

Thanks for testing.

[2.0.18] - 2024-06-17

Added

  • [dependencies]: Update dependencies
  • [schema]: Added schema to the root directory of the plugin
  • [properties]: Added soil_moisture properties as humidity sensor
  • [properties]: Added transition if the zigbee device supports it and the controller sends it. You can disable this globally adding transition to the featureBlackList or only for the single device adding transition to the deviceFeatureBlackList. (Thanks Stefan Schweiger)

Fixed

  • [schema]: Username and password are no more required fields (Thanks Stefan Schweiger)
  • [LevelControl]: Fixed the commandHandler for LevelControl in child endpoint (Thanks jpadie).
Buy me a coffee

If you don't want your name just tell me before I publish.

@Luligu
Copy link
Owner

Luligu commented Jun 18, 2024

This work unless you are using a local copy of the plugin..
In that case remove the plugin from the gui.
Install it globally like I wrote.
Add again the plugin and check it is the global installed one.

@Luligu
Copy link
Owner

Luligu commented Jun 18, 2024

matterbridge-1.3.0.zip

This is matterbridge. You need it before you install z2m plugin, cause there is a change in the api.

@stefan-schweiger
Copy link
Author

The transition seems to work fine, so thanks a lot for that! But I'm still seeing the username/password as required for the settings GUI

@stefan-schweiger
Copy link
Author

Ok seems like the npm -g install ~/Matterbridge/*.tgz didn't update the config file, if I manually copy it over it's fine

@Luligu
Copy link
Owner

Luligu commented Jun 18, 2024

Yeah I need to publish both cause when you noticed that I was refactoring the loading of schema from .matterbridge to plugin directory. And removing from matterbridge so I don't need to modify matterbridge to modify a plugin schema...

@Luligu
Copy link
Owner

Luligu commented Jun 18, 2024

I need to update ColorControl to Matter 1.3 (they changed a few stuff there). After I will add transition also there...
If everything is ok you can close the issue.
Thanks for collaborating with me.

@stefan-schweiger
Copy link
Author

Thanks again for implementing this so quickly :) let me know once the color control transition is ready then I can test that as well. I will leave the issue upon till then if that's ok for you

@Luligu Luligu changed the title Support transitionTime where applicable (e.g. moveToLevel) Support transitionTime where applicable (e.g. transition) Jun 21, 2024
@Luligu
Copy link
Owner

Luligu commented Jun 26, 2024

I didn't forget the transition on ColorControl...
Just need to publish again Matterbridge (probably if the tests go well tomorrow) and then I will add the transition.

@Luligu
Copy link
Owner

Luligu commented Jul 1, 2024

matterbridge-zigbee2mqtt-2.1.5.zip

[2.1.5] - 2024-07-01

Changed

  • [zigbee]: Fixed WindowCovering.targetPositionLiftPercent100ths update.
  • [z2m]: Added transition to ColorControl if the zigbee device supports it and the controller sends it. You can disable this globally adding transition to the featureBlackList or only for the single device adding transition to the deviceFeatureBlackList. (Thanks Stefan Schweiger).

Can you please test the transition on ColorControl ?

@stefan-schweiger
Copy link
Author

Sure, give me a few minutes and I will come back to you!

@stefan-schweiger
Copy link
Author

Seems to work exactly as expected! Thank you very much again for implementing this.

@Luligu
Copy link
Owner

Luligu commented Jul 1, 2024

My pleasure,
one day maybe all the controllers will have the option for transition...
Thanks for testing and for the idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants