The stoptimer node has ii functions. Information technology refreshes the timer whenever it receives a new bulletin, which is useful for motion automations; and it can start a timer when something happens, and stop the timer if something else happens.

They are very useful in motility lighting automations.

In the flow screenshot in a higher place, when the kitchen move sensor is triggered between sunset and sunrise, and if none of the living area lights are on, the kitchen can bulbs 1 and 3 are turned on at 10% for 25 seconds, and then they are turned off. Nosotros'll get to the turn off loop I'k using afterwards in the post.

In this flow, every time the motion sensor is triggered, a new bulletin is sent down the line. If that message reaches the stoptimer before the 25 second timer has ended, it restarts. This volition proceed the lights on until 25 seconds after the final triggered motion event. Make sure that the stoptimer duration is not shorter than the refresh duration of your motion sensor. My sensors refresh every 15 seconds, so any timer above 16 seconds will keep the lights on as long equally motion is detected.

So, what if you desire to stop the timer?

I take automations setup to monitor my outside refrigerator, because my knucklehead kids will go out the door cracked and information technology will defrost. So I thought I'd put something together to help stop that.

Here's what that looks like:

In this menstruation, the top two flows monitors the refrigerator and freezer doors, the bottom ii monitors the temps.

For the doors, an "event:state" node is monitoring the door state. When the door is opened, information technology sends from the top output which starts a stoptimer for three minutes. If the door remains open past that three minutes, a notification is sent to Telegram, which alerts my wife and I. If during that 3 minutes, the door is airtight, information technology sends from the bottom output which triggers a "alter" node that changes the msg.payload to "STOP", which then is sent to the stoptimer node, and the timer is stopped and a notification is non sent.

For the temperatures, an "effect:land" node is monitoring the temps of the freezer/refrigerator, which is then sent to a switch node. The switch node determines if the temps are equal-to-or-college than a certain value (xx degrees for the freezer, 50 for the refrigerator), and if they are, to pass information technology on to the stoptimer which starts a 10 minute timer. I'thou using 10 minutes, considering the temps can temporarily rise by those values when the door is opened, and the timer gives information technology enough fourth dimension to stabilize. If it wasn't there, a notification would get sent most every time the door was opened. So if the temps rise over the set up value for more than 10 minutes, it's safe to assume something is wrong.

One time the temp drops back down beneath the set value, the message is sent from the bottom output which triggers another change node, that will stop the timer, which again, cancels any notifications that were going to be sent.

When to use a stoptimer, instead of a delay node?

A delay node is very uncomplicated, information technology literally delays any messages for the duration of fourth dimension that you ready. There'due south a few more things it tin can do, but as far as stopping information technology like a stoptimer, there is no function for this. So, when should you use a delay node instead of a stoptimer? Well, technically, yous tin employ a stoptimer every bit a standard delay node if you wanted to, but I like to try to utilize them for their specific purpose, as it makes looking at a flow easier for me.

Lets look at another of my lighting automations.

Above is an automation used with our dining room light. In our house, the dining room low-cal is one of those lights that just gets left on all the time, for no detail reason. I put this flow together to plough it off if there is no motility in the dining room room for 20 minutes. I take an "events:state" node checking for motility, and passing it on to a "current:state" node when movement is detected. The current state node checks to see if the Dining room light is on, and if it is, information technology passes the bulletin on to the stoptimer node, which triggers the 20 infinitesimal timer. Whenever motion is detected, it sends another message, which restarts the timer, keeping the light on. When no motility is detected for 20 minutes, the low-cal turns off. If a delay node was used here, the light would come up on for twenty minutes, turn off, and and so immediately come back on if move is constantly beingness detected. This means the light volition wink every twenty minutes, every bit long as someone is triggering the move detector. So it makes sense to use a stoptimer hither in the flow.

When you look further downwardly the flow, afterwards the stoptimer node, you come across a phone call service node which turns off the dining room calorie-free. This then starts a 1 second delay node, which so sends to a electric current state node that checks the country of the dining room light. If the light is off, everything stops here. If the light is on, it loops back to the call service node to plough the low-cal off. I started using these turn off loops when I noticed on rare occasions lights wouldn't plough off or on correctly. Since there is no reason to stop the timer, a filibuster node tin exist used here. The delay node is stopped whenever the current country node says the light is off, and it doesn't loop the message back around to the call service node to turn off the light. I stoptimer node could exist used hither, and it would work correctly and the menstruation would operate correctly, merely information technology's not "needed". It's sort of a "all-time practices" thing; its best practice to use the correct node in a specific situation.

Below are the codes for the flows if you want to mess around with them.

(Amazon links are affiliate links, where I get a small committee of purchased detail)

Our son has a SmartThings button, and a Google Abode in his bedchamber. He plays with the GHome and we employ it for slumber sounds at dark. Someday afterward 9pm, the button turns on his lamp at 10% red, and so we yell "Hey Google, play the sound of rain at 70% volume!" The whole betoken of all this automation stuff is to make our lives easier. So I ready off to make his GHome come on with the nightlight.

I had no idea how to practice this. I spent many days searching and turning up nothing. So I had to effigy it out, and this is how I dood it.

I started by connecting an "events: land node" to a "debug" node. Remember to set the debug node to "consummate msg object"

I go into my son's room and say "Hey Google, play the sound of rain", and then checking out the output of the debug node. You lot'll see something similar this:

When the Google Home started playing, it was "idle", and and then the state changed to "playing". The "topic" shows you the device id, and the "payload" shows you the country. The "msgid" is unique to every message and is what keeps track of an individual message as it travels through nodes. We're non worried most that in this example, only I wanted to give an caption on information technology.

Let's break downwardly the "playing" message. Striking the arrow next to topic to drill down. This volition testify the topic, which is the original data, just a footling easier to read.

We now need to drill downwards into data, so hitting the arrow next to "data: object". This shows you the data of the object.

Yous'll see old_state, and new state. We'll review both of these, but lets kickoff with old_state.

Here you see the entity_id "media_player.wyatts_speaker" and that its old_state was "idle" at 2:13pm on 10-15-19. Silly Brits and how they do fourth dimension 😉 Ignore attributes and context for the fourth dimension existence.

Permit's go ahead and shut old_state past clicking the arrow, and drill down "new_state".

This shows pretty much the same info every bit old_state, but now shows that it is "playing". Let's drill downward into attributes.

There's a lot of info here. Let's take a break from this for a minute, so we can come across exactly what data nosotros need to play the rain sounds on Wyatt'due south GHome. To discover this out, grab a telephone call service node. Under domain, type "media_player" and in service, type "play_media", then click out of the field.

Once you type in the Domain and Service, a list of commands volition populate below, which are very helpful in figuring this out. In this instance we see "entity_id", "media_content_id" and "media_content_type". In this case, we demand to utilise all 3 of these commands, which I figured out from trial and error. A lot of times, and probably almost of the time, y'all volition non need all of the commands listed, just a few of them.

And so with this information, lets go back to the attributes of the new_state.

I have no idea what app_id is, so I blurred it.. Information technology seems to be the only thing that is unique between devices and so I blurred it simply in case.

Here we tin can run into the media_content_id that we're going to need to notice and play the media, in this case it'south the sound of pelting. Nosotros're going to take this and plug it into the call service node. Go ahead and enter the entity_id that you lot want this to play on, as well equally the content id. The format should exist "media_content_id":"https://xxxxxxxx.com” . Pay attending to the quotes and semi colon placement, and make sure to blazon in the open and closed brackets. Click the JSON editor to see if the lawmaking is properly formatted.

Here's how the code looks in the JSON editor:

At this point, we've satisfied two of the requirements that are needed to brand this happen.

The last part "media_content_type" is an easy one, equally information technology tells us what our options are in the description. For this one, we need to utilize "music", and then it will look similar this; "media_content_type":"music". Here's how it looks in the node config:

Here's how it looks in the JSON editor:

So now we have a properly configured telephone call service node to play the rain sounds on the GHome. To exam it, we'll connect an inject node.

When the inject tab is clicked, information technology plays the rain sounds from the GHome. Now, when it starts playing, it's going to play at what always volume the Google Domicile was last used at. Let's fix that…grab another call service node.

The domain needs to exist "media_player", the service needs to be "volume_set", the entity_id is whatever device you're adjusting the volume on and the data needs to exist {"volume_level":0.x}. The volume level is in .1 increments. So 0.7 is 70% volume. 0.2 would be 20%, ane.0 would be 100%, etc.

Now we'll take this service node and place it later on the inject node, just before the other service node.

Now when the tab is pressed, the book of the GHome is set to 70% and then the pelting sounds starting time to play.

And so at present we have a working flow, although it is manually triggered. There are many ways to automate this. One way is to utilize an inject node set to trigger at specific times.

The way that I'one thousand doing information technology is by button press. Permit'southward get into it.

We will outset demand an "events: all" node , and configure it to grab all zigbee events

We will demand to know what the hardware accost of the switch is, this is called the device_ieee. To figure that out, yous demand to connect a debug node to the zha_event node and expect for the messages when you press the push. Inside the payload volition exist the device_ieee. Copy that, and paste it into a switch node. Make sure to change the msg belongings to "msg.payload.effect.device_ieee".

So at present nosotros have the zha_event node monitoring all zha_events. Someday a zigbee device is triggered, it sends a zha_event, with all of it'due south information. The switch node and so reads the zha_events and filters the specific device_ieee to the output node.

This is what we take now

Now we demand to differentiate the different button presses ie; single press, double press, long press, etc. Well, how practise we figure that out? We need another debug node, attached to the switch node.

Now when you printing the button in different ways, look for the "msg.payload.event.command". Ordinarily information technology will be close to the clarification of the action you performed. In the instance of the SmartThings button, the event control for a single press is button_single, a double press is button_double and a hold is button_hold. For your button, just go along pressing it and digging through the debug node output to find out what yours is. Once you figure that out, paste them into a switch node. Make sure to alter the msg holding to "payload.issue.command." so the switch can grab the individual button presses.

A single button press will come up from the summit output, a double printing volition come from the heart and a button hold volition come from the bottom output. Place this switch node, behind the final switch node nosotros worked with.

And so, if we desire the Google Home to play rain sounds with a single button press, we need to connect the two service nodes nosotros worked with earlier, to the top node.

So now we have a working flow. a single button press will turn on the GHome and play rain sounds at 70% volume. Allow's brand a double press plow it off. All nosotros need is a call service node configured to plow off the GHome.

So connect information technology to the middle output on the switch node.

So at present we have a complete, working catamenia. A unmarried push press will play the rain sounds at 70% volume, and a double press will turn them off.

(Amazon links are chapter links, where I get a small-scale commission of purchased item)

I accept a SkyBell Hard disk drive doorbell, and it sends notifications to my wife and I with the SkyBell app when it detects move or the doorbell push button is pressed. Information technology works well enough, merely it's another split app sending carve up notifications. The entire point of automation is to brand life easier, so let's see about getting those notification in Telegram, with the rest of our smart domicile notifications. Here's how the native app looks:

Here's how the notification looks inside Telegram:

In that location's a few dissimilar parts to this flow. We're going to send a notification for both motion, and button printing. In one case move or button press is detected, a phone call service node takes a snapshot of the camera, stores it locally on your Home Assistant hub, waits i second to allow it to salvage properly, and and so another telephone call service node sends information technology as a notification.

Let's do eet.

First part is easy, information technology'southward two state nodes monitoring the Skybell, one for the push press, one for the motion.

Hither'south how the configurations looks for the doorbell motion:

Here's how the doorbell push looks:

Next is the call service node taking a snapshot:

Here's how information technology looks on the inside:

A few things we demand to go over with this. The "snapshot" service does what it'south chosen, it takes a snapshot of the camera yous specify in entity ID. In this case, "camera.front_door_last_activity" is the camera we'll exist taking a snapshot from. In the Data field, you lot'll notice "filename" and the location of where the snapshot will be stored. And then a snapshot is taken of the photographic camera, and stored where you specify in the information field. We so use a filibuster node set to 1 2d to give the snapshot time to copy to the file location. We then use a call service node to send the snapshot from the relieve location to whatever notify service you are using. I'm using Telegram, and then I ship it with the send_photo service. Below is the configuration.

With this period configuration, you lot will receive a photo of your doorbell when motion is detected, or the button is pressed. Here'due south the code.

Location based automations are a groovy mode for your business firm to answer to your presence. Set your thermostat, alarm, and lights depending on whether yous are habitation or non.

I do this using trigger country nodes.

This nodes considers an entity'due south current and previous state and passes on the bulletin. Nosotros're going to use it in it'southward nigh basic form, which is very piece of cake.

This tin can piece of work with any entity that has more than one land, simply we're using it with my life360 device tracker right now. In this instance, if my device tracker goes from "not_home" to "abode" pass the message from the top output. Anything else goes from the bottom output.

Let's put together a basic location based flow.

We're going to grab a trigger state node and two telephone call service nodes. Remember that if everything is true, it routes the superlative output, if not, bottom output. Then if I get from not_home to home, top output.

The two phone call service nodes I'm using in this example are to control my Ecobee thermostat, but yous can utilise yours to do whatever you similar. Lights, security organisation, garage door…whatsoever service that can exist chosen. Here's how one of those look:

And here's how the unabridged flow looks:

Pretty simple, just very powerful if used properly. Here'southward the code

If y'all already have a Telegram bot setup in Node-Cherry-red, see my mail, Better notifications with Telegram and Node-RED to transport notifications with Telegram formatting and logging.

In my humble opinion, Telegram is probably the best way to send and receive notifications from Home Assistant. You tin create groups for everyone in your house, yous tin respond to notifications, receive pictures, videos or even gifs. It'south a keen service…and doesn't cost a thing. The setup isn't also bad, but it does require some programming in YAML.

Here is the official documentation on creating a chatbot within Home Assistant. Although you'll have to create a Telegram Bot first. Make certain do both of these things. Too, here'due south all the absurd things a Telegram Bot tin can do once it's setup.

Alright and then now that I've gotten all my swooning out of the way, you'll need to kickoff add the bot to your configuration file, as per the official documentation. If you're not, yous should definitely be using the secrets.yaml

**One thing to remember, for how we're setting up our Telegram bot in this particular case, you'll want to set the platform to "broadcast" and not "polling". If you set it up as polling, your Dwelling Assistant log volition get flooded with Telegram bot multiple instances errors, after yous setup the Node-RED side of things.**

Once this is done, you can use a telephone call service node to test the Telegram bot. Here's how information technology should look to examination:

Connect an inject node, and press the tab to test.

You should receive a "Test" message from your telegram bot. Y'all can also see the notifications with a moving picture from my doorbell. We'll become to that in some other mail.

At present you take working Telegram bot notifications inside Abode Assistant. Not to bad right? Here's an example of a notification with a button to respond. I use these in my "Warning has been armed" notifications, as well as the "Alarm has been triggered" notification. We can disarm the warning when it'due south armed for whatever reason, or disarm it when it is triggered. Hither's what the call service node configuration looks like:

This is how information technology looks when the notification is received.

Telegram bots answer to commands, that are sent with a forward slash. /arm and /disarm are examples, merely your Telegram bot doesn't know what to do with them withal.

So how do we get Telegram to respond to the /disarm control that is sent when the Disarm button is pressed? This requires installing some new nodes so we tin run the bot in Node-Cherry. To start, click the top correct hamburger menu and get to "Manage palette".

In one case at that place, in the search bar, search for "node-blood-red-contrib-chatbot". You lot'll see i result. This is Redbot, an incredibly proficient Node-RED chatbot. Install it and wait a few seconds. You'll get a notification when it's done. This installs a agglomeration of new nodes, 74 to be verbal, as of this writing. This initially will look very daunting at first, just it'due south really not, and we'll go through the basic setup.

Before we go on, if you don't recall or can't discover the API token that was given to you during your bots creation, go talk to the BotFather and send him the /token command, and he'll requite you the API token for your bot. On we go…

There are ii nodes that you need to pull out, Telegram In, and Telegram Out.

Put those guys in a new tab in Node-RED. Open up up one of them, doesn't matter which, and click the edit button to the correct of Bot configuration (evolution).

Make full information technology out with all this info:

Click Add, which will take you back to the chief node configuration. Use the drop down under Bot configuration (development) and select the bot you only created.

Go to the other Telegram node, and use the pull downwardly to select the bot you created. Both of these nodes are now configured.

The Telegram Receiver, or Telegram In, node is what listens for commands when you ship them to your bot, which it grabs and sends out through it's output. The Telegram Sender, or Telegram Out, node receives any commands or messages and sends them to the conversation. We demand to put some logic in between them and so the bot knows what do when we tell it. We'll start super simple and then yous can encounter exactly what is happening.

Beginning, grab a Command node; and place information technology after the Receiver node. Open up up the node and type /hello in the command field.

The command node volition heed to everything coming from the Receiver Node and volition grab all of the /hello commands. Adjacent, grab a text node and place information technology after the command node. Type Hello, {{firstName}}! in the message box. This will respond with your first proper noun (or any you used when creating yous Telegram account). If yous want a smiley, add :smile:.

Hither's what yous have now:

You have simple logic that volition answer with "Hi, Justin!" when it receives the /howdy command. Allow'south exam it out. Open up your Telegram app and send /hullo to your bot.

At present you have a working Telegram bot.

So, lets take what we know now, and make the /arm and /disarm commands (or whatever commands you desire) piece of work. We're going to need another command node, and set it to grab /arm commands. Connect a new text node to the command node and ready the message to "The House has been Armed", and finally add together a telephone call service node to the finish of information technology. Beneath is how the service node is configured in my example, but you can use information technology to anything you like. You can utilize it to send you a motion picture of one of your cameras, tell you what temperature the business firm is, etc.

Now, connect everything upward to the Transport and Receiver nodes and you'll take this:

To review, the receiver node receives any messages you send to the bot. The control node filters out the control you plan it with. The text node sends whatever message yous program information technology with as a response from the bot. The calls service node is not function of the bot, it'south merely wired in so that the bots messages will trigger the service. Hither'southward what the completed bot looks like with arm and disarm both setup

Motion automations are some of my favorites. I've noticed a lot of questions across the net near how to set them up, and then I'll practise a few simple ones to aid others get started.

Motion activated low-cal.
Super uncomplicated. Grab an "events: state" node undefined, and a "call service" node undefined. Configure the events state node with your motility sensor. Here's an example of mine:

If yous put a value in the "If State" field, you will have ii outputs. Top is "true", bottom is "false". In this node, the If State is "on", so if movement is "on" (truthful), output from the top, when movement is "off"(imitation) output from the bottom. Think of it similar "If state is true – superlative", and "if state is false – bottom". Doing it this mode, the catamenia will kickoff when move is detected, or true, if continued to the meridian. If connected to the lesser, the flow will start once there is no move. If you leave this field blank, there volition only be a unmarried output node that will trigger every time the land goes from on to off, and off to on.

The "Output just on state alter" setting is important to how your flow volition behave. Lets say that the motion sensor you are using is in the living room and you're having a party. At that place's a ton of people in your business firm and at that place'south constant motion. The motion sensor volition trigger when it first senses motion, and it will stay triggered until it no longer senses motion. With "Output only on state alter" checked, it volition merely send out a bulletin from the output one time, when it was initially triggered by move. This is because the land has not changed from "on". If you uncheck "Output merely on state alter", it will transport a new message every time the motion sensor is triggered. different motion sensors check for motion at different intervals. All of the motion sensors that I employ (I highly recommend the Zooz ZSE40) trigger about every 15 seconds. Then a new trigger bulletin would be sent every 15 seconds with non end motion.

If you're brand new to this, I realize that's a lot of info, but it will brand sense soon enough.

On to the call service node. It will need to be configured like this:

"Domain" is the starting time part of an entity in Abode Assistant. "climate.xxxx" would be the domain of a thermostat, "lock.xxxx" would be the domain for a smart lock, etc. In this instance, nosotros're using the "light" domain.

"service" is the activity yous desire to perform, in this case, "turn_on" which will turn on the low-cal that we specify when triggered. After you've selected your domain, you tin can use the drop downwards menu to see what services are available. Beneath y'all'll run into that the options are "toggle", "turn_off" and "turn_on".

"Entity Id" is where you specify what device to control. if you type in "low-cal", information technology will auto complete every entity that is in the light domain, and yous can only select the entity you want.

With both of these done, the most basic configurations are done. You now need to just connect the nodes. Now what we take is a complete working period. When the Entryway Motion node state is "on", it will turn on the Entryway Lights, and that's it.

Like shooting fish in a barrel flow, but essentially useless in the automation sense of things. Lets have the light turn off after a ready period of fourth dimension.

Motion activated light with timer .
We want the light to turn off at some betoken, so nosotros're going to work off the catamenia that we but created and make that happen. First catch a "stoptimer" node, undefined and wire it later the other two nodes.

The way the stoptimer node works; Once it receives a message, in this instance from the Entryway Lights node, which was passed on from the Entryway Motion node, it starts a 5 second timer. One time the 5 seconds are over, it sends the message. If the stoptimer node receives another bulletin within the v 2nd timer, it restarts the timer.

Grab some other call service node and attach it to the height output of the stoptimer node. Configure information technology exactly as you did the beginning call service node, except utilize the "turn_off" service. And so this is what you'll have:

Then now, motility in the entryway, turns on the entryway lights, waits 5 seconds and turns off the entryway lights. Are you still with me? Don't worry about it if yous're not, it'll all work out in the end.

So at this signal we take a consummate just inefficient menstruation. We tin fix this solely with configuring the nodes in a different way.

How do we brand this a usable menstruum?
It's easy. As nosotros've said a few times already, our example move sensor refreshes every 15 seconds and sends a new message depending on the state of the node. If there is constant movement, information technology will send a message of "on" every fifteen seconds. No motion will send "off" every fifteen seconds. If there was was move and information technology sent "on, and and so no motion, the next message will be "off", etc etc, you probably get the betoken past at present. Besides retrieve, that the stoptimer resets if information technology receives some other message before the timer is over. So if it's a v second timer, and it receives another message at 4 seconds, it starts back over at v seconds.
Then, knowing this, we can set the stoptimer to anytime longer than the refresh time of it'southward input. The instance motility sensor sends an update every 15 seconds, so we tin set the stoptimer to sixteen seconds. The movement sensor sends a bulletin the first time it detects motion, which turns on the lights and and then starts the stoptimer. If in that location is no more motion, the light will turn off in 16 seconds. If there is withal move, within the 16 seconds, it restarts the timer. The timer volition exist restarted equally long equally in that location is motion, which volition leave the light on while the room is occupied.

Or volition it? Remember that cheque box, "Output only on country change" ? With this checked, even though the motility sensor sends an update every fifteen seconds, the Entryway Motion node would not send an update because the state stays "on" with abiding motion. State doesn't change, it doesn't ship a new message. With it checked, information technology would but send a new update to the meridian output when the motion went from on, to off and then back to on.

So, we uncheck it. This will allow the Entryway Motion node to send a new update every time information technology receives i from the motility sensor, fifty-fifty if the land never changes. Even if the state stays to on for an hour because in that location'southward abiding motion, information technology yet sends an update every fifteen seconds from the move sensor, and since the timer is set to 16 seconds, the low-cal always stays on with move.

If your motion sensor sends a new update every eight seconds, you'd want to fix the stoptimer to ix seconds to go on the calorie-free on with motion. Twenty second motility sensor, 21 seconds stop timer, etc etc.

Hither's the code of the in a higher place flow for import.

Here's another movement menstruum every bit an example. If the dining room low-cal is left on, and there is motion, the light will stay on. If there is no move for 20 minutes, the low-cal turns off. Le' Code.

In this post, I will prove how I setup my home security system. Setup this way, information technology is a manual organization, and will need to be manually armed and disarmed. I will share how I've automated the system in afterward posts, that will be linked here.

My final two houses were smart homes. SmartThings was my hub of choice at the beginning, and it was good. One of the things I liked then much about SmartThings was the Smart Dwelling house Monitor that is built in. This does a few things, one of which is act as a security organisation, which is what nosotros used it for. In that location is nothing like this built into Home Banana out of the box, so one of my get-go goals when learning Node-Blood-red was to create a home security system.

Home Assistant has a built in Manual Alarm Command Panel that tin can be used to build a security system, which all has to happen in the config files. Since I'm doing all of my automations in Node-Ruby-red, I wanted to try building a security organization from a combination of the built in panel and Node-Cherry. I wanted to be able to set the alarm mode from the panel and have Node-RED handle the rest.

To offset off, I created an "alarm.yaml" in the config directory of Dwelling house Assistant, and fabricated sure to add "alarm_control_panel: !include alarm.yaml" in the config file. This is the code that I used, which will allow the away alarm to trigger afterward 120 seconds, and requite you 30 seconds to leave the house in one case it's armed. All other modes arm instantly.

This will create a "alarm_control_panel.home_alarm" entity, which when used in Lovelace, looks like this:

Then at present that the forepart-end is done, time to move on to the dorsum-terminate of the machine. I built all of the logic inside Node-Blood-red. This is how the finished result looks.

The "events: state" node undefined grabs the status of the Manual Alert Command Console, and passes it on to the switch node undefined which then filters the alarm status to the advisable output.

Below that, is the trigger automation. The "Alarm Triggers" sub-menstruum contains all of the doors and windows in the business firm, which is connected to another sub-menstruum that checks if the alert is armed either dwelling, or abroad, and and so passes it on to a call service node that triggers the alarm, and finally sends a Telegram notification letting us know the alarm has been triggered, along with a button to Disarm the alarm. Example of the "Armed Home" sub-menstruation.

Sub-flow for the Armed Home mode for reference,

Since there's and then much going on with this menstruation, I won't become through it in detail, just I will mail the code which y'all should be able to work off. It'south pretty direct frontward.

Here'due south the Node-Red lawmaking: Security System
Here'due south the yaml code for the panel: alert.yaml

Currently, there is zilch automation involved. This has to be manually set, but I have location and timed based automations which I will share in future postings.


Updates:

8/24/2020 – Updated the warning.yaml lawmaking to reflect recent updates Home Assistant has had regarding the manual alarm console.

(Amazon links are affiliate links, where I become a small commission of purchased item)

I have half dozen Hue A19 Color bulbs in the ceiling of my kitchen. We were using them with standard dummy switches, which was a hurting every bit I had to constantly remind people to leave the switches on. Not to mention that information technology is bad for smart bulbs to exist constantly powered on and off. I was most to pull out the smart bulbs and install standard LED lights and get with smart switches, only I really did not want to do this, equally the individual bulbs are used for certain automations. For case, a nightlight where bulbs i and 3 are motion controlled to come up on at 5% if everything else is turned off, and information technology's dark outside.

How to get effectually this to go on my smart bulbs AND proceed them powered at all times? At first, I tried using a Sylvania Dimming switch and command the lights with a scene. This switch is placed over the existing dummy switch, which yous leave flipped on. Since this was a 3-way setup, I put a switch embrace over the second switch (you lot could also go a second Sylvania switch). This worked….I now had ever powered and physically controllable smart bulbs, and although it was a applied solution, it was kind of ugly. The married woman definitely didn't similar the look in her new home, so I was dorsum to trying to figure this out.

All of the smart switches in my house are of the Go Control / Linear / Nu Tone diverseness. These are all fabricated by the aforementioned manufacturer, but sold under different names. They are non Z-Moving ridge Plus, simply I got the first one years ago and have been matching them together ever since. I haven't noticed whatsoever downfalls of them non being Z-Wave Plus, but they'll eventually be upgraded. For a three way setup, there is the NuTone NWT00Z which are non standard improver switches. These are "virtual 3-mode" switches. The depression ratings on Amazon are somewhat understandable equally the documentation (PDF of the transmission here and here) is cryptic at best, and does not say explicitly how to use these. I will say that we've had these installed for a few months at present with zero issues.

The fashion these are intended to work, are as "remotes" to other switches. In my entryway, I take 1 installed in a 3-way setup with a NWD500Z dimmer switch. Y'all wire it up and and information technology controls the master switch in a zwave grouping association, only we're going to do something different with them.

I used ii of these in my kitchen. The way to wire them and have the lights e'er on is an odd fashion. Take the load, line and traveler wires from the wall, as well every bit the load line from the get-go switch and connect them all together. The ground and neutral are wired up equally normal. The second switch needs to exist wired a little differently as well. Take the line and load wires from the wall, cap them together and stuff them into the wall. Accept the traveler wire, which is at present a constant 120v line, and connect it to the load line of the NWT00Z. Wire the basis and neutral up as normal.

Now what we accept are two smart switches that are wired up and connected to the mains, but they practice not command the power to the lights. The ability is at present abiding to the smart bulbs. At this signal, the lights will stay powered on, unless you lot command them from Lovelace or using vocalism if you take Google Home/Alexa setup, but theres no way to mechanically control them yet. The hard part is done and we now accept to head over to Node-RED and beginning working on the automation to turn these on or off.

We tin't add the switches to a Zwave group association, as the Hue lights are zigbee. And so we need to catch the zwave effect blazon commands coming from the switch. To do this, use a "events: all" node and filter "zwave.node_event" commands. Example below.

"events: all" node

So now we're grabbing all node_events from the "zwave." domain, now we need to filter them. To exercise this, we need a switch node to filter the "payload.entity_id" from the specific switches nosotros setup. You'll need to use the proper name that you gave these switches when including them in your network. 1 thing to remember, you lot need to use the "zwave" domain proper name, Not the "switch" domain proper noun.

At this bespeak, nosotros're filtering the two switches with "payload.entity_id". Now we need to filter it down again to go the bodily commands from the switches. With these switches, "0" is off and "255" is on. We need another switch node and filter "payload.event.basic_level". This volition grab all ".basic_level" events that come over the two switches. You'll want to connect both output nodes from the previous switch node to the input on this switch node. This volition filter all commands from both switches to this node. In this node, the top output will be "on" and the bottom output volition be "off".

We're almost done at this point. Now nosotros demand to use a call service node to turn on, and off the lights. I forgot to mention earlier that the easiest way to command multiple lights, is with a lite group. This volition create a "group.kitchen_lights" entity in Home Assistant. You lot'll need to exercise this in your config.yaml or groups.yaml in Home Assistant.

Now we have a telephone call service node, and configure it to control the kitchen_lights group. Nosotros need ane for on, and ane for off. The "on" node will exist connected to the top output, and the "off" node volition be connected to the bottom output.

Phone call service node to plough on the kitchen_light grouping.
Call service node to turn off the kitchen_light group.

Here is how the unabridged flow looks:

With this setup, we have Hue smart bulbs that are always powered and tin be manually controlled by a switch. This allows individual bulbs to be used in automations and you don't have to worry almost the switches, like in me previous example of using lights 1 and three for a nightlight.

One more than thing to keep in mind; When smart bulbs lose power, they will come on at full brightness when power is restored. The Hue span however has a setting for "ability on beliefs" where you can tell the bulbs what to exercise when power is restored.

Here is the formatted code if you'd like to import information technology and piece of work off of it.