RemoteController Fails to Update Status/Refresh

I am working on a profile for a remote control. There are no custom vids or capabilities. The buttons will not update their status when I emit events from them. They remain in standby mode. The device will also not send an event for pull-to-refresh. I have seen other refresh issues, but those were with custom vids, this is not.

This is being tested on Android. Here is the profile:

name: controller4
components:
  - id: main
    capabilities:
      - id: button
        version: 1
      - id: battery
        version: 1
      - id: execute
        version: 1
      - id: refresh
        version: 1
    categories:
      - name: RemoteController
  - id: button1
    capabilities:
      - id: button
        version: 1
    categories:
      - name: RemoteController
  - id: button2
    capabilities:
      - id: button
        version: 1
    categories:
      - name: RemoteController
  - id: button3
    capabilities:
      - id: button
        version: 1
    categories:
      - name: RemoteController
  - id: button4
    capabilities:
      - id: button
        version: 1
    categories:
      - name: RemoteController

Code to change the button state. I have tried with a variety of button states and they are all being setup in the supported button states.

device:emit_event(capabilities.button.supportedButtonValues({
  'down',
  'held',
  'up',
  'pushed',
  'double',
  'down_hold'
}))
device:emit_event(capabilities.button.button('down'))

You’ll need to set the state_change flag to true on the button events otherwise consecutive button presses of the same type won’t work. They may show up in the app UI but they won’t propagate any further to automations of the device history.

The standby status is purely an invention of the app. You should see it change but it’ll always change back.

Where do you see this? I don’t see it in the button capability docs.

It is in the Edge Driver reference. A similar thing existed in DTHs.

Found it. That’s a good hint and probably would have bit me at some point, so thanks. Unfortunately, the state in the app still won’t change away from standby.

Hi, @blueyetisoftware!
I noticed “down” isn’t part of the supportedButtonValues property, does it happen for every option included there?

Yeah. That was just a bad example. I put this paired down example in there from two different attempts. I can add ‘down’ and get the same result.

I updated the original post for clarity

Have you tried something like this?

device:emit_event(capabilities.button.button.down({state_change = true}))

I checked this driver and that’s how the command is used.

When you send this command, in the logs, do you see if the event is sent correctly?

Yes. The event is emitted, just no UI change. The example below also uses the state_change attribute

<Device: XXXXXXX (My Button)> emitting event: {"attribute_id":"button","capability_id":"button","component_id":"button3","state":{"value":"down_hold"},"state_change":true}

I have also verified that the events are working as expected by send a notification to myself when the button is pressed. The automation works fine.

I tried to replicate this without success. I don’t know if it’s because the app was updated. In this case, I use the capability Switch to trigger the event:

Have you checked the behavior with the new version?
Next, I’ll check with your config.
Update: I couldn’t replicate it using your profile and supportedValues defined :thinking:

I will ensure I have the latest version and check again. Thank you very much for taking the time to mock it up.

1 Like

I downloaded the latest app update and this now works as expected using the same code base and test as before.

Thanks for your help

1 Like

Refresh of this button device is now working as well, so 2 for 2. Thanks again.

1 Like