Hi there, I just added a power strip using ZHA. It all worked perfectly fine, but the different power outlets are given the device class “light” instead of “switch”. Anybody knows how I can change the device class from “light” to “switch”?
I don’t think you can, but you can turn a light into a switch using a template switch
So I tried to add the following to my configuration yaml but it wouldn´t accept it:
> switch:
> - platform: template
> switches:
> Mehrfachsteckdose_1:
> value_template: "{{ is_state('switch.source', 'on') }}"
> turn_on:
> service: switch.turn_on
> target:
> entity_id: light.mehrfach_steckdose_stecker_1
> turn_off:
> service: switch.turn_off
> target:
> entity_id: light.mehrfach_steckdose_stecker_1
I never used such template before so I´m a little lost here tbh
Do you have such entity ?
I just used the example given. I have no clue where to enter the entity of my actual switch or what services I have to address…
Change
value_template: "{{ is_state('switch.source', 'on') }}"
to
value_template: "{{ is_state('light.mehrfach_steckdose_stecker_1', 'on') }}"
That´s the way I got it actually working:
switch:
- platform: template
switches:
stecker_1:
friendly_name: "Steckerleiste - Stecker 1"
value_template: "{{ is_state('light.mehrfach_steckdose_stecker_1', 'on') }}"
turn_on:
service: light.turn_on
target:
entity_id: light.mehrfach_steckdose_stecker_1
turn_off:
service: light.turn_off
target:
entity_id: light.mehrfach_steckdose_stecker_1
I also found a way better approach to actually change the device type for ZHA integration which is described here: Zigbee Home Automation - Home Assistant
I have this issue, too, and have not found a working solution.
Do u also use ZHA?
I tried…it did not work. Looking for a solution.
zha:
device_config:
00:12:4b:00:22:69:ad:f2:
type: ‘switch’
00:12:4b:00:22:69:9d:32:
type: ‘switch’
Looks like you are missing the endpoint_id. The Format is {ieee} - {endpoint_id}
Could you give me an example? Not sure what you mean by “endpoint_id” I think the Hex is the IEEE.
This is how it looks for my integration:
zha:
device_config:
00:12:4b:00:22:ed:55:37-1:
type: "switch"
00:12:4b:00:22:ed:55:37-2:
type: "switch"`
It looks like your device has two switches in it. Mine is a single switch, so no endpoint_id needed, unless it is a “-1”. If you look at the IEEE ID, they are identical between the two entries.
Thats true, it´s a device with multiple power outlets. Still, I believe you need the endpoint_id added to have it working.