Leggin / dirigera

This repository provides an unofficial Python client for controlling the IKEA Dirigera Smart Home Hub.
MIT License
120 stars 24 forks source link

ClickPattern determines the button, not the press type? #90

Closed ValonVN0 closed 1 month ago

ValonVN0 commented 2 months ago

Hey there,

Been tinkering some more with the controllers today (in this case Rodret) since I found the controller was only reacting when pressing the one button (usually the main action button)

Finally got around to testing using the different ClickPatterns and for whatever reason that's allowing the other button to function?

Here's a super quick example I wrote up which I was intending to add a scene for each ClickPattern

controllers = hub.get_controllers()
for controller in controllers:
    try:

        click_type = [ClickPattern.SINGLE_PRESS, ClickPattern.DOUBLE_PRESS, ClickPattern.LONG_PRESS]
        click_type_string = ["single","double","long"]

        for i in range(0, 3):

            exists = False
            scenes = hub.get_scenes()
            for scene in scenes:
                if scene.info.name == controller.id + "_" + click_type_string[i]:
                    exists = True
                    break

            if not exists:
                hub.create_scene(
                info=Info(name=controller.id + "_" + click_type_string[i], icon=Icon.SCENES_HEART),
                scene_type=SceneType.USER_SCENE,
                triggers=[
                    Trigger(type="app", disabled=False),
                    Trigger(type="controller", disabled=False,
                        trigger=TriggerDetails(clickPattern=click_type[i], buttonIndex=0,
                        deviceId=controller.id,
                        controllerType=ControllerType.SHORTCUT_CONTROLLER))])

    except:
        pass

As I mentioned in a previous post, I expected the buttonindex to determine which button the scene would be linked to, however all instances would be placing this on buttonindex 0, the only real difference being the ClickPattern?

On one side, happy days since I can use the controller to its full potential, on the other side, why on earth is the ClickPattern determining this?

Update: Also tested using Styrbar, much like Rodret it seems the buttons are mapped as such:

Unfortunately in the case of Styrbar I can't seem to get the dimming buttons working, but it's certainly progress from having only 1 button on each controller.