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

Local connection with button #4

Open
jujupointcom opened this issue Sep 4, 2022 · 8 comments
Open

Local connection with button #4

jujupointcom opened this issue Sep 4, 2022 · 8 comments

Comments

@jujupointcom
Copy link
Contributor

Hi,
Using the spurl option instead of api key, to go though local connection does not work for controls of type "button". Using a switch type command on the same device works fine.
Code to handle button has been copied from the switch one, so I do not understand where is the issue.
Thanks

@coelhoricardo
Copy link

+1

@Endymion78
Copy link

Hi,
It's quite an old issue, but it still exists. Same problem here.

@Endymion78
Copy link

Endymion78 commented Feb 5, 2024

Problem solved by adding the following lines in bold to the device configuration in the yaml file exported from Airsend Cloud (thanks to Devmel support for this tip) :

id: xxx
note:
  method: 1
  type: 1
  value: 2

I also applied the following action on the card driving my device :

tap_action:
  action: call-service
  service: button.press
  target:
    entity_id: button.my_button_entity
  data: {}

Hope it might help someone

@SchubmannM
Copy link

Problem solved by adding the following lines in bold to the device configuration in the yaml file exported from Airsend Cloud (thanks to Devmel support for this tip) :

id: xxx note:   method: 1   type: 1   value: 2

I also applied the following action on the card driving my device :

tap_action:   action: call-service   service: button.press   target:     entity_id: button.my_button_entity   data: {}

Hope it might help someone

I tried this but didn't get it to work.

But are you suggesting the button code should be changed from

    def press(self, **kwargs: Any) -> None:
        """Handle the button press."""
        note = {"method": 1, "type": 0, "value": "TOGGLE"}
        if self._device.transfer(note, self.entity_id) == True:
            self.schedule_update_ha_state()

to

    def press(self, **kwargs: Any) -> None:
        """Handle the button press."""
        note = {"method": 1, "type": 1, "value": 2}
        if self._device.transfer(note, self.entity_id) == True:
            self.schedule_update_ha_state()

@Endymion78
Copy link

I didn't change the button code and don't think you have to.
If I understand well the code in device.py file, lines 189 to 200, the notes added in yaml file will override the ones in the button code, with the same result as the code change you suggest.
When I submitted them my problem, Devmel support told me that "value" set to 2 in these additionnal notes in yaml file may not work, and in this case I could try to set "value" to 1, 4 or 8. Maybe you can give it a try.
If it still doesn't work I suggest you to open a ticket to Devmel support. They answer quickly and will probably have the solution for your issue.

@Nosnahc
Copy link

Nosnahc commented Oct 18, 2024

@coelhoricardo un petit up ?

@coelhoricardo
Copy link

@coelhoricardo un petit up ?

je ne vois pas pourquoi tu me tags 😅

@Nosnahc
Copy link

Nosnahc commented Oct 23, 2024

@coelhoricardo un petit up ?

je ne vois pas pourquoi tu me tags 😅

Missclick complet vraiment navré !

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

5 participants