# How can i check if a bulb turn on by regular switch?

**URL:** <https://discourse.nodered.org/t/how-can-i-check-if-a-bulb-turn-on-by-regular-switch/72608>\
**Category:** General\
**Tags:** home-assistant\
**Created:** [22 December 2022 22:33 UTC](https://discourse.nodered.org/t/how-can-i-check-if-a-bulb-turn-on-by-regular-switch/72608 "2022-12-22T22:33:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sko](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Sko](https://discourse.nodered.org/u/Sko)\
**Post date:** [22 December 2022 22:33 UTC](https://discourse.nodered.org/t/how-can-i-check-if-a-bulb-turn-on-by-regular-switch/72608/1 "2022-12-22T22:33:39Z")

</div>

Hi Forum,

I m new to home assistant and node-red. I have in a room a regular switch and a smart bulb. The bulb is programmed by "behavior on power" to on. Is it possible to become a payload "on" when i switch with a regular switch the power on? I want to change after power on the kelvin and brightness depending on sunset.

Thx a lot for your help.  
Best Sko

// PS: I m using Home Assistant, zigbee2mqtt, raspberry pi 4, sonoff usb stick.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [23 December 2022 02:16 UTC](https://discourse.nodered.org/t/how-can-i-check-if-a-bulb-turn-on-by-regular-switch/72608/2 "2022-12-23T02:16:17Z")

</div>

If the regular switch is off, does that mean there is no power to the smart bulb and it's not connected to zigbee?

Does it send some sort of status message - "Hi, I'm online" or "Power: on"?

---

<div class="post-metadata">

**Author:** ![Sko](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Sko](https://discourse.nodered.org/u/Sko)\
**Post date:** [23 December 2022 08:19 UTC](https://discourse.nodered.org/t/how-can-i-check-if-a-bulb-turn-on-by-regular-switch/72608/3 "2022-12-23T08:19:00Z")

</div>

Thx for your replay. Yes when the regular switch is off there is no power to the smart bulb. I tried "event state" and "trigger state" with the bulb inside and connected to a debug node with all infos on. But I dont get any message. Is there a way to get a message with an other node? Its a tradfri bulb, perhaps they dont send any messages when they are turned on by "behavior on power"?

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [23 December 2022 10:19 UTC](https://discourse.nodered.org/t/how-can-i-check-if-a-bulb-turn-on-by-regular-switch/72608/4 "2022-12-23T10:19:04Z")

</div>

I don't have Tradfri or Home assistant and my zigbee hub is stuck in the drawer because I don't know how to integrate it. So I don't know how they work together.

With a "normal" network, Wifi and ethernet, there are several ways I can tell when a device connects.  
The slowest and so least satisfactory way is for Node-red to periodically send a message which rwquires a response, like ping.

There must be an equivalent ability with zigbee but I am sorry I have no idea what it is.

---

<div class="post-metadata">

**Author:** ![Sko](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Sko](https://discourse.nodered.org/u/Sko)\
**Post date:** [23 December 2022 17:48 UTC](https://discourse.nodered.org/t/how-can-i-check-if-a-bulb-turn-on-by-regular-switch/72608/5 "2022-12-23T17:48:54Z")

</div>

Ok thx for your reply 🙂

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [23 December 2022 22:15 UTC](https://discourse.nodered.org/t/how-can-i-check-if-a-bulb-turn-on-by-regular-switch/72608/6 "2022-12-23T22:15:44Z")

</div>

My zigbee lights send a message as soon as they are switch on so you could use this to send the required color\_temp & brightness command. If you connect a debug node to an MQTT in node with the relevant topic you should be able to check your light

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [23 December 2022 22:17 UTC](https://discourse.nodered.org/t/how-can-i-check-if-a-bulb-turn-on-by-regular-switch/72608/7 "2022-12-23T22:17:25Z")

</div>

Install mqttexplorer in a PC on the network, connect to your mqtt broker and see what topics the bulb publishes when it is switched on. Then switch it off and see what you get. There may be an Online/Offline state there somewhere.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 February 2023 22:18 UTC](https://discourse.nodered.org/t/how-can-i-check-if-a-bulb-turn-on-by-regular-switch/72608/8 "2023-02-21T22:18:08Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
