# Detecting on/off status and actuating a switch with Node-RED

**URL:** <https://discourse.nodered.org/t/detecting-on-off-status-and-actuating-a-switch-with-node-red/93549>\
**Category:** Hardware\
**Created:** [28 November 2024 16:21 UTC](https://discourse.nodered.org/t/detecting-on-off-status-and-actuating-a-switch-with-node-red/93549 "2024-11-28T16:21:05Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![HaroldPetersInskipp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/haroldpetersinskipp/32/42319_2.png) [@HaroldPetersInskipp](https://discourse.nodered.org/u/HaroldPetersInskipp)\
**Post date:** [28 November 2024 16:21 UTC](https://discourse.nodered.org/t/detecting-on-off-status-and-actuating-a-switch-with-node-red/93549/1 "2024-11-28T16:21:05Z")

</div>

Any advice on how to go about detecting the status of this type of led-switch in a non-destructive or intrusive way to automate it with Node-RED?

 ![550x428](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/1/51161e1e6785e87988f257852fe49c2a5fccd1f8.jpeg)

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [28 November 2024 16:28 UTC](https://discourse.nodered.org/t/detecting-on-off-status-and-actuating-a-switch-with-node-red/93549/2 "2024-11-28T16:28:53Z")

</div>

Going to need more of a clue than just a picture 🙂

---

<div class="post-metadata">

**Author:** ![HaroldPetersInskipp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/haroldpetersinskipp/32/42319_2.png) [@HaroldPetersInskipp](https://discourse.nodered.org/u/HaroldPetersInskipp)\
**Post date:** [28 November 2024 16:40 UTC](https://discourse.nodered.org/t/detecting-on-off-status-and-actuating-a-switch-with-node-red/93549/3 "2024-11-28T16:40:57Z")

</div>

I need a way to detect if the device's switch is in the on or off position, it lights up an led inside the red switch when in the on position. And I need a way to actuate the red switch, hopefully without destructive/intrusive means (his mom would not appreciate that for a school project). But I don't know what kind of hardware/sensor would be best to accomplish this task. So far I tried an LDR but in a well lit room that seems to not work very well.

---

<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:** [28 November 2024 16:47 UTC](https://discourse.nodered.org/t/detecting-on-off-status-and-actuating-a-switch-with-node-red/93549/4 "2024-11-28T16:47:15Z")

</div>

Does it have any comms capability? If not then I suppose you could sense it with a light sensor, but to actuate it you will presumably need some sort of mechanical device.

---

<div class="post-metadata">

**Author:** ![HaroldPetersInskipp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/haroldpetersinskipp/32/42319_2.png) [@HaroldPetersInskipp](https://discourse.nodered.org/u/HaroldPetersInskipp)\
**Post date:** [28 November 2024 17:44 UTC](https://discourse.nodered.org/t/detecting-on-off-status-and-actuating-a-switch-with-node-red/93549/5 "2024-11-28T17:44:25Z")

</div>

I have a servo that I think I'm going to end up using to actuate it, the detection part is more the issue I think. No comms unfortunately.

---

<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:** [28 November 2024 21:01 UTC](https://discourse.nodered.org/t/detecting-on-off-status-and-actuating-a-switch-with-node-red/93549/6 "2024-11-28T21:01:55Z")

</div>

Surround the switch in a lightproof (more or less) box and then the sensing should be reliable. You are going to need some sort of housing for the solenoid anyway.

---

<div class="post-metadata">

**Author:** ![HaroldPetersInskipp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/haroldpetersinskipp/32/42319_2.png) [@HaroldPetersInskipp](https://discourse.nodered.org/u/HaroldPetersInskipp)\
**Post date:** [28 November 2024 22:56 UTC](https://discourse.nodered.org/t/detecting-on-off-status-and-actuating-a-switch-with-node-red/93549/7 "2024-11-28T22:56:12Z")

</div>

Thanks, I think this is the route I'll go down first, if no problems then I may have to go to a makerspace and 3D print a housing to replace a scrap materials test version.

---

<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:** [28 November 2024 23:05 UTC](https://discourse.nodered.org/t/detecting-on-off-status-and-actuating-a-switch-with-node-red/93549/8 "2024-11-28T23:05:06Z")

</div>

Plug the device into a smart socket which has power monitoring and you can interrogate the socket.

My Espresso machine was built before the internet and it's definitely not smart, yet from the smart socket I can tell that it is currently switched on and consuming 1100 Watts

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/8/a8733230957214a3113121999586d6eeb53633dc.png)

And because the Espresso machine switch is always On, I can turn the boiler on via the smart switch before I venture out of bed in the morning.

---

<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:** [29 November 2024 10:22 UTC](https://discourse.nodered.org/t/detecting-on-off-status-and-actuating-a-switch-with-node-red/93549/9 "2024-11-29T10:22:33Z")

</div>

Yes, if the on/off feature can be achieved by switching the power supply then use an external device to do that. I use Zigbee sockets for such things.

---

<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:** [28 January 2025 10:23 UTC](https://discourse.nodered.org/t/detecting-on-off-status-and-actuating-a-switch-with-node-red/93549/10 "2025-01-28T10:23:25Z")

</div>

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