Node Red Experiences

Hi,

Im all so want to move node-red to a dedicated RPI.
Please let me know how it works for you if it get slower or stays fast.

I have it now running on dedicated RPI and it is much faster for my setup.

When I click my Xiaomi buttons the light gets on without any recognizable delay … even my wife realized that all the lights and sonos announcement (e.g. doorbell) is much faster.

My Hass.io is setup with Duckdns and I have to reference HA with my external https://mydomain.duckdns.org and all my Node-red traffic is currently passed through internet but I’m going to fix this shortly with the use of PIHole.

I have documented the entire Node-Red setup process and will share shortly as there are a few key things required to get it all working.

1 Like

Thanks for this. Will wait for your documentation about howto use pihole to make node red local and not via internet

If you’re planning to share, can you make it via a new post to keep the thread and follow-up questions the focus of your setup. Thanks!

I have done such a thing and the speed of automations is awesome. Nothing really to fear from going down this route you could even export your flows directly in if you wanted but I started a fresh.

3 Likes

I’m still experimenting , but PIHole was not the solution due to the requirement of a local SSL :frowning: … I keep trying

At moment I start to think it is not worth having the remote access directly for HA as it limits the internal usage/access dramatically.

Sounds like you just need to figure out how a dns call works and configure a local dns server…

Its an impressive setup. But how do you dare to relay so much on sd cards?

What nonsense.

1 Like

Regular Snapshots are you’re best friend plus I use the more expensive multiple read sd cards designed for security cameras.

I am starting to get a hold of node red and i created my second flow … i have a samsung tv and it wont work with IP commands its one of the cursed models that won’t work with IP … so i bought a broadlink r3 mini and i am very pleased with my purchase for 15 bucks you cant beat it…

Any ways here is my flow … i would love some inputs of it and if there is a way to simplify it…

[{"id":"26c7604a.7c8dc","type":"api-call-service","z":"5e004ff.54db4b","name":"Tv on","server":"2868a7ae.627a88","service_domain":"homeassistant","service":"turn_on","data":"{\"entity_id\":\"switch.tv\"}","mergecontext":"","x":570,"y":360,"wires":[[]]},{"id":"15c9ffee.03fce","type":"delay","z":"5e004ff.54db4b","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":580,"y":420,"wires":[["186a7a13.c7a176"]]},{"id":"186a7a13.c7a176","type":"api-call-service","z":"5e004ff.54db4b","name":"HDMI 2","server":"2868a7ae.627a88","service_domain":"homeassistant","service":"toggle","data":"{\"entity_id\":\"switch.hdmi_2\"}","mergecontext":"","x":760,"y":420,"wires":[[]]},{"id":"c4c9a646.b73688","type":"api-call-service","z":"5e004ff.54db4b","name":"Netflix Roku","server":"2868a7ae.627a88","service_domain":"media_player","service":"select_source","data":"{\"entity_id\": \"media_player.roku_premiere\", \"source\":\"Netflix\"}","mergecontext":"","x":370,"y":400,"wires":[[]]},{"id":"93e7134b.efdd6","type":"api-current-state","z":"5e004ff.54db4b","name":"TV on","server":"2868a7ae.627a88","halt_if":"","override_topic":true,"override_payload":true,"entity_id":"media_player.samsung_led75_un75h6350","x":350,"y":260,"wires":[["ccb2cff0.b244d"]]},{"id":"ccb2cff0.b244d","type":"api-call-service","z":"5e004ff.54db4b","name":"HDMI 2","server":"2868a7ae.627a88","service_domain":"homeassistant","service":"toggle","data":"{\"entity_id\":\"switch.hdmi_2\"}","mergecontext":"","x":520,"y":220,"wires":[[]]},{"id":"294ad482.3d4c3c","type":"api-current-state","z":"5e004ff.54db4b","name":"TV off","server":"2868a7ae.627a88","halt_if":"","override_topic":true,"override_payload":true,"entity_id":"media_player.samsung_led75_un75h6350","x":350,"y":340,"wires":[["26c7604a.7c8dc","15c9ffee.03fce"]]},{"id":"b50a0b47.e4ff28","type":"alexa-local","z":"5e004ff.54db4b","devicename":"Netflix","inputtrigger":false,"x":150,"y":340,"wires":[["c4c9a646.b73688","93e7134b.efdd6","294ad482.3d4c3c","4ae41821.8b92d8"]]},{"id":"4ae41821.8b92d8","type":"api-call-service","z":"5e004ff.54db4b","name":"Light Mood","server":"2868a7ae.627a88","service_domain":"homeassistant","service":"turn_on","data":"{\"entity_id\":\"scene.game\"}","mergecontext":"","x":370,"y":440,"wires":[[]]},{"id":"2868a7ae.627a88","type":"server","z":"","name":"Home Assistant","url":"http://hassio/homeassistant","pass":"XXXXXX"}]

1 Like

Hello all,

Nice little automation that I thought you might like:

It’s simply a contact sensor placed anywhere (in this case inside a wardrobe) that turns_on a light to a specified state (in the Call node). Before the turn_on call it saves the light’s current state to the node context. When you close the door it restores the light to its previous state via the context (whether that be white/colour/off).

Currently uses lifx_set_state in the restore Call because of the power option but you could use a switch node to call turn_on or turn_off depending on the state.

Code: https://www.hastebin.com/tokakupeza.json

2 Likes

Hey guys,

can someone help me with my flow?
I want to create a snapshot formated with date and time and upload it to dropbox via the hassio addon.

So it creates a snapshot, but it was named 6574cf55.tar instead of 2018-08-23T16_54_37_Snapshot as you can see in the screenshot. And the addon didnt upload the files.

This is the function:

msg.payload =
{
“data”:
{
“name”: (new Date().toISOString().replace(‘:’, ‘‘).replace(’:', '’).replace(/..+/, ‘’))+“_Snapshot”
}
}
return msg;

Can someone tell me whats wrong?

Edit:
Okay, I figured out why it wasn’t uploading. But I still can’t create a snapshot with a name. Even when I try the service call in the gui.

Edit 2:
Okay, when setting a name for the snapshot, it creates a name in a json file inside the archive. That’s a bit strange because I thought it would name the file itself. Nevermind, everything is working now.

Can you post this flow?
I like it, and would like to try it.

Thanks

Sure, I will post it tomorrow. I’m going to bed now :wink:

Here is my flow. But i need to say, that i adopted it from here. You need to change the settings for telegram (bot and chatid’s) and add the HA nodes.
And you need the following packages:

  • node-red-contrib-chatbot
  • node-red-contrib-light-scheduler

How can i create a spoiler?

[{
“id”: “84a2e0a7.a1b74”,
“type”: “light-scheduler”,
“z”: “1f5b10e9.27b647”,
“settings”: “59235be9.0ccc6c”,
“events”: “[{"start":{"dow":5,"mod":180},"end":{"dow":5,"mod":195}}]”,
“topic”: “”,
“name”: “Fri-03:00”,
“onPayload”: “ON”,
“onPayloadType”: “str”,
“offPayload”: “OFF”,
“offPayloadType”: “str”,
“onlyWhenDark”: false,
“sunElevationThreshold”: 6,
“sunShowElevationInStatus”: false,
“outputfreq”: “output.statechange”,
“x”: 60,
“y”: 160,
“wires”: [[“8ddd903d.204948”]]
},
{
“id”: “908d39b9.a0f7a”,
“type”: “api-call-service”,
“z”: “1f5b10e9.27b647”,
“name”: “purge_DB”,
“server”: “35940c50.480b14”,
“service_domain”: “recorder”,
“service”: “purge”,
“data”: “{"keep_days": "3"}”,
“mergecontext”: “”,
“x”: 330,
“y”: 160,
“wires”: [[“77359889.d83e8”,
“3dd9b0c9.49637”]]
},
{
“id”: “77359889.d83e8”,
“type”: “delay”,
“z”: “1f5b10e9.27b647”,
“name”: “”,
“pauseType”: “delay”,
“timeout”: “5”,
“timeoutUnits”: “minutes”,
“rate”: “1”,
“nbRateUnits”: “1”,
“rateUnits”: “second”,
“randomFirst”: “1”,
“randomLast”: “5”,
“randomUnits”: “seconds”,
“drop”: false,
“x”: 480,
“y”: 160,
“wires”: [[“47613e77.a25848”]]
},
{
“id”: “d0bf75cd.7be12”,
“type”: “api-call-service”,
“z”: “1f5b10e9.27b647”,
“name”: “snapshot_full”,
“server”: “35940c50.480b14”,
“service_domain”: “hassio”,
“service”: “snapshot_full”,
“data”: “{}”,
“mergecontext”: “”,
“x”: 840,
“y”: 160,
“wires”: [[“3dd9b0c9.49637”]]
},
{
“id”: “dd507e8d.1ace28”,
“type”: “delay”,
“z”: “1f5b10e9.27b647”,
“name”: “”,
“pauseType”: “delay”,
“timeout”: “25”,
“timeoutUnits”: “minutes”,
“rate”: “1”,
“nbRateUnits”: “1”,
“rateUnits”: “second”,
“randomFirst”: “1”,
“randomLast”: “5”,
“randomUnits”: “seconds”,
“drop”: false,
“x”: 290,
“y”: 240,
“wires”: [[“bd60d13e.3c471”]]
},
{
“id”: “bd60d13e.3c471”,
“type”: “api-call-service”,
“z”: “1f5b10e9.27b647”,
“name”: “upload”,
“server”: “35940c50.480b14”,
“service_domain”: “hassio”,
“service”: “addon_stdin”,
“data”: “{"addon":"7be23ff5_dropbox_sync","input":{"command":"upload"}}”,
“mergecontext”: “”,
“x”: 430,
“y”: 240,
“wires”: [[“e74ceec9.7fe7c8”,
“3dd9b0c9.49637”]]
},
{
“id”: “47613e77.a25848”,
“type”: “function”,
“z”: “1f5b10e9.27b647”,
“name”: “format snapshot”,
“func”: “msg.payload = \n{\n "data": \n {\n "name": (new Date().toISOString().replace(‘:’, ‘‘).replace(’:', '’).replace(/\…+/, ‘’))+"_Snapshot"\n }\n}\nreturn msg;”,
“outputs”: 1,
“noerr”: 0,
“x”: 660,
“y”: 160,
“wires”: [[“d0bf75cd.7be12”]]
},
{
“id”: “e74ceec9.7fe7c8”,
“type”: “chatbot-conversation”,
“z”: “1f5b10e9.27b647”,
“name”: “”,
“botTelegram”: “12345678.123456”,
“botSlack”: “”,
“botFacebook”: “”,
“botViber”: “”,
“botUniversal”: “”,
“chatId”: “XXXX”,
“transport”: “telegram”,
“messageId”: “”,
“contextMessageId”: false,
“store”: “”,
“x”: 640,
“y”: 240,
“wires”: [[“b1fb451e.ff9a”]]
},
{
“id”: “52b618da.2bf148”,
“type”: “chatbot-telegram-send”,
“z”: “1f5b10e9.27b647”,
“bot”: “12345678.123456”,
“botProduction”: “12345678.123456”,
“track”: false,
“passThrough”: false,
“outputs”: 0,
“x”: 990,
“y”: 240,
“wires”:
},
{
“id”: “b1fb451e.ff9a”,
“type”: “chatbot-message”,
“z”: “1f5b10e9.27b647”,
“name”: “”,
“message”: [{
“message”: “Backup erstellt und hochgeladen”
}],
“answer”: false,
“track”: false,
“x”: 810,
“y”: 240,
“wires”: [[“52b618da.2bf148”]]
},
{
“id”: “3dd9b0c9.49637”,
“type”: “debug”,
“z”: “1f5b10e9.27b647”,
“name”: “”,
“active”: true,
“tosidebar”: true,
“console”: false,
“tostatus”: false,
“complete”: “false”,
“x”: 690,
“y”: 360,
“wires”:
},
{
“id”: “8ddd903d.204948”,
“type”: “switch”,
“z”: “1f5b10e9.27b647”,
“name”: “ON”,
“property”: “payload”,
“propertyType”: “msg”,
“rules”: [{
“t”: “eq”,
“v”: “ON”,
“vt”: “str”
}],
“checkall”: “true”,
“repair”: false,
“outputs”: 1,
“x”: 190,
“y”: 160,
“wires”: [[“908d39b9.a0f7a”,
“dd507e8d.1ace28”]]
},
{
“id”: “a100aca2.f8fca”,
“type”: “inject”,
“z”: “1f5b10e9.27b647”,
“name”: “”,
“topic”: “”,
“payload”: “ON”,
“payloadType”: “str”,
“repeat”: “”,
“crontab”: “”,
“once”: false,
“onceDelay”: 0.1,
“x”: 190,
“y”: 80,
“wires”: [[“8ddd903d.204948”]]
},
{
“id”: “59235be9.0ccc6c”,
“type”: “light-scheduler-settings”,
“z”: “”,
“name”: “my settings”,
“latitude”: “50.4062”,
“longitude”: “7.4101”
},
{
“id”: “35940c50.480b14”,
“type”: “server”,
“z”: “”,
“name”: “Home Assistant”,
“url”: “http://hassio/homeassistant”,
“pass”: “xxxx”
},
{
“id”: “12345678.123456”,
“type”: “chatbot-telegram-node”,
“z”: “”,
“botname”: “@xxxx”,
“usernames”: “xxxx”,
“providerToken”: “xxxx”,
“polling”: “1000”,
“store”: “”,
“log”: “/config/node-red-telegram.log”,
“parseMode”: “”,
“debug”: false
}]

Hastebin is a good option for longer pieces of code, logs etc… Discord channel bot uses that as well.

Thanks. I’ll give it a try over the weekend.

@chimpy would you mind sharing your motion sensor code? I’d love to put that to work for my exterior motion sensor/lights. I like how you were able to bundle it all together into one unit. Thanks.

Hey man, sure thing.

Is it just the first bit? That’s just a node that takes all the events. Then I filter on motion events. Then I use a switch node to route the message according to the entity_id.

If you need the code for that I let me know, I’ll post it here when I’m back at home.