Adding an « Edit » button to the Philips Hue device cards to modify the feature category.
Explanation of the need:
Smart plugs are also used to turn on/off ambient lighting (for example, in my living room I have 2 Philips Hue plugs that control 3 ambient lamps that I turn on when watching TV). Unfortunately, as they are added as « switches » (which seems normal so far), they cannot be controlled by the dashboard command to turn off the room. This modification would allow this. Of course, this feature request also works for other Integrations like Tasmota, for example.
It’s a bit annoying, I’d love to get started, but next week I’m on paternity leave for 11 days (my little girl was born on November 11th), so I have a bit of time.
The only issue is that I’m not sure how to change the category ^^ I don’t think I’ll have any trouble picking up the front-end part, but for the rest… I’ll see if I can get to it.
I also wanted to work on the Netatmo integration, but unfortunately I can’t get in touch with @damalgos and his PR doesn’t contain the latest changes he made in May that allowed connection to the Netatmo account…
Top
Enjoy it with the little one 
Just look at how other integrations do it, and if you don’t understand, come and talk about it on the forum 
We addressed the topic for Tasmota devices.
We need to ensure that the feature type is the same when choosing to change category.
Light.binary == Switch.binary
And I thought, while I was sleeping, wouldn’t « virtual-devices » allow this kind of thing?
- change the category
- change a room feature (not the entire device)
- control an HTTP call (incoming soon via scenes)
All configured from the scenes, if the virtual device changes state, I change the state of another device.
This might be a bit heavy and hard to understand, right? The user always has to remember that they have 2 devices just to define one thing.
I think in this specific case, it would be better for the user to be able to say « this outlet is a light » 
I quite agree that it’s a bit heavy for the average user to manage, it can be discouraging. Especially since it should be able to be managed quite simply in the device parameters.
This should not be overlooked, we encounter the use case in several cases with Sonoff devices (4ch, 4chpro, dual, …) and in this case it’s more complicated to manage. Maybe to be planned in the « Discovery » menus of the integration, and have an additional option that asks if you want to separate the devices or even for these models 2 devices, directly separate the features into 2 or 4 devices. It’s better to have for the 4ch for example 2 separate devices even if they are in the same room. It can be configured very well anyway afterwards.
My use case may be a good example: I have a 4CH Pro that manages:
- 1 lighting in the bathroom,
- 1 outlet in the bathroom (heating)
- 1 lighting in the toilet,
- 1 lighting in the kitchen.
If the 4 are distinct devices I just have to configure the first two in the bathroom, the next one in the toilet and the last one in the kitchen.
This also solves the problem of titles on the dashboard since each has its own device name. All that’s left is to be able to change the feature in the device parameters if it’s lighting.
What do you think?
Even if we don’t consider the model, just a verification of the integration that separates any « switch » feature into multiple devices.
If you are OK @pierre-gilles and @AlexTrovato, I can look into this during the week if I am able to do it.
I was thinking about the question, where I agree that we want to make the « plugged-in lamp » case possible, I’m not sure if we want the user to be able to modify the entire configuration of these services that are supposed to be plug-and-play.
We really need to expose only the vital minimum to the end user.
We agree that we want to add an « Edit » button to the Philips Hue integration, in this style:
Then, this button displays a view of this style:
On this view, I think we only want to allow the modification of the category if it’s a plug that we want to turn into a light.
For example, we could have a true/false toggle « this plug is a lamp, allow Gladys to control this plug as a lamp », which would switch the category from switch to light and vice versa.
What do you think?
@pierre-gilles, for me, this would already be perfect from this point of view and more than sufficient. Simple and effective = Gladys v4 ^^
But what about the multi-switch part mentioned earlier for you?
A much more complex and much more « philosophical » problem than just this feature category change in Philips Hue 
Can we have a specific topic to discuss this issue?
Otherwise, as soon as we finish the Philips Hue task, the multi-switch problem will be pushed aside.
You are absolutely right, sorry!!
Hello, have we opened a specific topic for this subject?
Hello,
Following up on the PR and discussions on the topic, to integrate this feature, I was planning to create a parameter for the device feature when creating the device, something like this:
- device_id = device id
- value = [
{
device_feature_external_id: device feature 2 id,
create_category: "switch"
},
{
device_feature_external_id: device feature 2 id,
create_category: "switch"
}
]
So when we create the device, we have the info, and when we check the box, it changes the category to « light » and this is taken into account in the lights without having to make any particular changes in development. After that, we can even say that we display the base category in its card. And this can be reused for other integrations that have the same problem (we were talking about the issue of Sonoff relays as switches that often control lights).
Does this work? For already created devices, I was thinking of putting a condition in the actions « if device feature switch/binary and the paramdevice of the create_category » does not exist, then we create it. Would that work?
Is there a file where we can manually edit this parameter in the meantime?
Hello!! Well, yes and no.
For my part, I modified directly in the DB, in the t_device_feature table in the category column, but be careful with subsequent instability (on my side, I stop the gladys container, and then I modify with the sqlite3 command line). If you are not in production but in development, you can modify the file server/services/philips-hue/lib/models/plugOnOff.js and change in features:
category: DEVICE_FEATURE_CATEGORIES.SWITCH,
by
category: DEVICE_FEATURE_CATEGORIES.LIGHT,
After that, we might be able to modify in the production docker container, but I don’t know how to do it and I think it will have to be redone with each update.