Help in making an IKEA (or other zigbee switches) turn on/off a bulp?

Hi HA community.
My setup is: Raspberry Pi3+ and Conbee (Dresden Electronics) running deConz.

Im a newbee in this. A lot of things has gone well so far. Found zigbee devices and Hue bridge as well. Even made the tracker ”finding me”!!

On forums i found a recipe for setting up a sensor that turns on a light for 1 minute and i all works well.

BUT i cant make a simple switch from IKEA Trådfri turn on or off a bulp. I tryed to set i up in Automations. I tryed to Copy and Paste the setup for the sensor and edit that, but nothing works.

I also have a Xiaomi Toggle Switch, and no luck there as well.

Where do i start? Do i have to add something into configuration.yalm, automation.yalm or what.

Thank you in advance.

Martin

Just add the ligth to a card (lovelace).

-title: Lights
 panel: false
 cards:
  -type: entities
   enteties:
    -entity: light.room1

Thank you Vennerberg for replying so fast. But about card. what card to i choose and where do i put that script you added in your second post?

billede

Im talking about this IKEA Switch that shout turn on a light

Well you start with the entetys.
spoiler: I not familiar with deConz, but anyway.
First - check out your states tab ( icon looks like <>) on the far left corner at the bottom.
In there you find all the devices witch HA knows so far.
when you did well you should find either an sensor or binary_sensor wich changes the state as you press it.
from there you can make an automation. with the - platform: state

https://screenshots.firefox.com/EzJrx9Abn82oHxU3/hassio.local

I can see all my sensors lights in <>… then what?

I can already tell you that you got the wrong sensor here - thats the one for your battery level.
get me the entety ID’s of your switch and light and Ill write you an very basic automation for starters

Ah… :bulb: i thing i got the switches wrong somehow… Thank you so far W_B
BRB

most welcome.
I ll be on the move now. so still here a basic example.
when your light is a switch (also common for lights) you have to replace light.toggle with switch.toggle - you could also visit at discord https://discordapp.com/invite/c5DvZ4e
When there is somebody who knows how to help we’re awnsering :wink:


automation:

  - alias: light_toogle
    initial_state: 'on'
    trigger:
      - platform: state
        entity_id: binary_sensor.theentetyidofyourikeaswitch
    action:
      - service: light.toggle
        entity_id: light.thelightyouwanttotoggle

another thing. read up a little bit about yaml
https://www.home-assistant.io/docs/configuration/yaml/

how I pasted it now its good at a package https://www.home-assistant.io/docs/configuration/packages/
but automations.yaml will throw you an error.

Thank you so far… Im now trying to find out how to add my switches as a “switch” and not a thing that shows me the state of the battery.
Have a nice day
martin

Its meight be just underneath the battery level - or as said - it could also be an binary_sensor.
press in the states tab comand+f for searching and look for tradffri_on

Did you already pair the switches to Deconz?

There are various ways to go about it:

  1. just pair the sensors and bulbs with deconz and make all the automations in home assistant (as suggested before)
  • positive: you have all kind of automations and scripts in one place
  • downside: it’s a bit thumbersome at the beginning
  1. create easy things (like switches) inside the Phoscon UI.
  • positive: It’s much more straight forward to configure the buttons with the Phoscon UI
  • downside: eventually you will get things cluttered with easy automations inside Phoscon, other things as Home Assistant scripts (and eventually others in Node Red)

I found managing easy customizations like switches easiest when I configure it inside the phoscon app (option 2). I never ran into any issues like this. See how to configure switches here.

It’s just easier, Home Assistant doesn’t even get involved here. If you don’t like the phoscon UI, you can even try the Android App “Hue Essentials”. It lets you control your Phoscon Gateway same as a Hue bridge and allows for customization of switches, too! (Not sure if the ones you got are supported though).

Deconz switches aren’t displayed as binary sensors (only their battery level or temperature sensor for motion sensors get.
Quote from the docs:

Remote controls (ZHASwitch category) will not be exposed as regular entities, but as events named deconz_event with a payload of id and event . Id will be the device name from deCONZ and Event will be the momentary state of the switch. However, a sensor entity will be created that shows the battery level of the switch as reported by deCONZ, named sensor.device_name_battery_level.

This is the automation I use, this (1002) is the middle button of the 5 button IKEA remote:

- id: '1237846198766'
  alias: Turn off lamp from ikea switch
  trigger:
    platform: event
    event_type: deconz_event
    event_data:
      id: tradfri_remote_control
      event: 1002
  action:
    service: light.toggle
    data:
      entity_id: light.lamp

I have one of these for each button, with the correct codes replaced.

Use the event listener to determine the event codes when each button pressed, listen to “deconz_event”

thank you capstan1. Thats where im stuck now… :wink: If i can “import” the switches fra Deconz to HA i think that all my problems will be solved… So next issue is how to integrate them from Deconz

And Holdestmade ill try yours as wel
Thank you

I keep it all in HA as don’t only control the lights in deconz with them. I use them to start scenes and control non-zigbee bulbs/outlets

Hi Martin

It is very simple, just follow the following steps:

  • Pair the IKEA switch with deCONZ (don’t changes the name)
  • In HA go to settings - integration, under deCONZ Zigbee gateway…find the device “TRÅDFRI remote control” and clik on it.
  • A Device info screen turs up - under Automations “due something when…” (In Danish “Gør noget, når…”)
  • The rest is easy

Jeg håber du kan bruge det - du må gerne mail til mig på [email protected]

1 Like

Hej Søren
Tak for svaret. Da jeg startede denne tråd var det absolut ikke så let at finde wireless switch devices som det er blevet nu. Der er stadig et stykke vej, men det går den rigtige vej.
mvh martin
[email protected]

1 Like