Exclude switch from list if device type is changed from switch to light

Hi .*,

I have a sensor which gives the number of plugs I have turned on:

    plugs_on_count:
        friendly_name: Number of lights on
        icon_template: mdi:power-plug
        value_template: >-
            {{ states.switch | selectattr('state', 'eq', 'on') | list | length }}

Now there is this feature that you can change the device type from a switch (plug) to a light.

Is there any way to change my query above and exclude the switches which are hidden? I am googling here the forums but I couldn’t find a solution, and I dont seem to find if the device has maybe a hidden attribute or something.

I manage to with the developer template figure out that in this case the device has two entities, one switch and one light, but I can’t see how could I find that the switch. entity is hidden.

Appreciate the help! Thanks,

David