Need help with the front-end development of a v4 service

Hello,

I’m trying to build the front end for the Sonos service, but I’m stuck
I don’t understand how to execute an action, for example, pressing a button
I’ve looked at other services and tried several things in vain

Here’s how I’m doing it:

In the .jsx file, I add

<button class="btn btn-info btn-sm" onClick={props.getDevices}>
   <Text id="integration.sonos.searchForDevicesButton" /> <i class="fe fe-radio" />
</button>

In actions.js:

import createActionsIntegration from '../../../../actions/integration';

function createActions(store) {
  const integrationActions = createActionsIntegration(store);
  const actions = {
getDevices(state) {
  console.log('test');
  const devices = [{name : "test1", ip:"192.168.1.42"}];
},
  };

  return Object.assign({}, integrationActions, actions);
}

export default createActions;

I press the button, but I never see the logs, and the device doesn’t appear either

How do you do it on your side?

Here are the sources of my repo:


return <YeelightLightPage {...props} integration={integrationConfig[props.user.language]['yeelight']} />;

Voila, you need to pass the props in your index.js to the sonos.jsx

Same for me! I have an issue with changing the value of a feature name.

          [index]: {
            features: {
              [value.getAttribute('data-key')]: {
                [field]: {
                  $set: value.value
                }
              }
            }
          }

Knowing that index is the device number, value.getAttribute(‹ data-key ›) is the index of the feature I want to modify, and field is the feature name.

Basically, I want to change the value of the correct feature ^^ and it’s not working, does anyone know why?

Hi @NilkOne
I see that you’ve done a lot of work on the Sonos service integration for V4.
First of all, a big thank you :clap:t2:
I also have a Sonos Play:1 and I would love to be able to integrate it into gladys V4.
Can you give me an update on the progress of this service for V4, I’m of course available if you need testers :wink: