LIFX Developer Zone

Home Assistant: LIFX Switch

Hi Everyone!
I use Home Assistant for my automation.
I have two LIFX Switches but they don’t show up in Home Assistant as a device/entity.
Actually, I use Node-RED currently which I think must use a LAN API?


Is there some way I can control the LIFX Switch using Home Assistant/Node-RED?
Thanks!

I have this working with Home Assistant and Node-RED using node-red-contrib-lifx-api The commands are all via https but I can track state and setup switches in HA to control each switch. Its not lan control so I am reliant on LIFX cloud control

Hey Lebowski9000!
Thanks so much for this, I don’t know how I missed that.
I can now see the switch in Node-RED and can control the whole switch quite easily, however, I haven’t been able to figure out how to control each relay.
Are you able to show me how you have been able to control each relay? I have used the labels of each relay, however, that didn’t work (I tested using a label from a light which worked fine so I know that the token etc works)

This should help

label:Front Switch|0
label:Front Switch|1
label:Front Switch|2
label:Front Switch|3

I found toggle is buggy so use on and off commands

I also use a timestamp to poll the states to make a sensor in Home Assistant so I can see the state.

I use this on the switch to read the on or off
image

I also use the custom Node RED component to make a switch inside node red with the trigger command automation for on and off to make Home Assistant control them.

1 Like

I have discovered something around the LIFX Switch and the LIFX integration in HA. HA (for me) stalls on start up for 4-5 mins trying to (from what I can guess) discover the switches. When I move LIFX to complete manual config. Home Assistant starts up instantly. I can replicate the issue by putting in the IP address of the Switch into the manual config and it will stall HA on start up.

Thanks for the inspiration @Lebowski9000 ! FYI - This is how I’ve solved it similarly in HA with node-red.

In my setup I’ve got 80+ LIFX lights, but I only have 1 “dumb” set of smart festoons wired into a switch that I want to control, so I only care about controlling 1 relay of 1 switch (I have 13 :slight_smile: )

  • Rather than a separate switch & sensor entity in HASS, I’ve got one switch entity I create in node-red.
  • I query the state of the physical relay every second in case someone changes the power state physically on the switch, and if there is a change I pass this as a msg.enable true/false boolean to the HA switch entity. This will update the state in HASS, but the node will not output and fire a state change on physical switch :+1:
  • When you change the switch state within HASS this triggers a LIFX set-state to change power of the physical relay

Works great thus far and I’ve then got a Light entity using the switch platform in HASS which I surface to Google Assistant and my dashboard so I’m controlling a Light entity which subsequently uses the switch entity.

Thanks for the inspo…this was the final thing in my setup I couldn’t control with GA!

Wondering now about taking it a step further. As my festoon lights are smart, but on FLUX platform, I might be able to leave that circuit powered on and then connect the relay button to something in LIFX for node-red to monitor and control soft power state on FLUX platform. I think I’ll need to have a LIFX light that doesn’t actually do anything to act as a “ghost” device though, possible could use a Z-strip/beam controller that’s not connected to an actual light.

1 Like

Is there any chance you could post the JSON for the node flow? Trying to replicate this for a switch in my shed and it is not playing the game at all :joy:

How do you make the relays ‘soft’?

I bought a bunch of these switches and had them installed but it is forcing me to choose a LIFX light/group in order to use the ‘soft switching’ feature …

Hi,

I’ve spent a couple hours trying to recreate what you’ve done and I just can’t quite get it to work. Is there any chance you could please share your json of this flow so I can see its inner workings? If not all good.

Thanks for your time.
Cheers

Worst product ever, I paid a fortune for all my light switches and the electrician but I am going to have them removed.

You’ll probably land on this page if you look up the LIFX Switches and Home Assistant, if you do then please do not purchase this product (unless you only have LIFX lights).

Confirmed; I see the same behaviour. I just fixed something else in the LIFX integration, so I’ll poke it with a stick and see if I can work out what’s causing this bug.

Btw, local control of the relays from Home Assistant is possible using Photons Interactor. It’s pretty much the same setup, except the HTTP requests are a little more on the single-origin, hand-crafted bespoke side of things. :slight_smile:

It’s just making good use of the Photons feature of being able to send any type of LAN packet. In this case, you want to send GetRPower and SetRPower and you’ll get a StateRPower response.

Could you help share a little more detail on your setup? Would be appreciated.

Hi Folks, here’s the current JSON & visual flow for how I have Node Red hooked up for switches. I have this hooked up to exhaust fans now on bathroom switches which I automate with motion sensors to turn of/on. So now I’m doing a single API list lights call to LIFX and filtering that to a number of switches.

[
    {
        "id": "cc1f7120.b3cab",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": ""
    },
    {
        "id": "f358dc3ff9bdc34f",
        "type": "inject",
        "z": "cc1f7120.b3cab",
        "name": "1 sec poll",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "1",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 110,
        "y": 260,
        "wires": [
            [
                "e1989bac28f81913"
            ]
        ]
    },
    {
        "id": "285ed345863c673a",
        "type": "debug",
        "z": "cc1f7120.b3cab",
        "d": true,
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 470,
        "y": 100,
        "wires": []
    },
    {
        "id": "e1989bac28f81913",
        "type": "lifx-list-lights",
        "z": "cc1f7120.b3cab",
        "name": "lifx list lights",
        "api": "5e36f9dd.8c4718",
        "selector": "group:Switches",
        "x": 270,
        "y": 260,
        "wires": [
            [
                "285ed345863c673a",
                "8ab1fa3f08714286",
                "4964329616c74427",
                "bf22c9756d0c0269"
            ]
        ]
    },
    {
        "id": "cf302ec6dda204cf",
        "type": "change",
        "z": "cc1f7120.b3cab",
        "name": "state on",
        "rules": [
            {
                "t": "set",
                "p": "enable",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 820,
        "y": 140,
        "wires": [
            [
                "91352fc512b88b7f"
            ]
        ]
    },
    {
        "id": "1418bfb6f3f00c27",
        "type": "switch",
        "z": "cc1f7120.b3cab",
        "name": "kitchen switch state",
        "property": "payload[11].relays.relays[0].power",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "on",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "off",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 630,
        "y": 160,
        "wires": [
            [
                "cf302ec6dda204cf"
            ],
            [
                "0b4d2e5cd0b2abb6"
            ]
        ]
    },
    {
        "id": "0b4d2e5cd0b2abb6",
        "type": "change",
        "z": "cc1f7120.b3cab",
        "name": "state off",
        "rules": [
            {
                "t": "set",
                "p": "enable",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 820,
        "y": 180,
        "wires": [
            [
                "91352fc512b88b7f"
            ]
        ]
    },
    {
        "id": "91352fc512b88b7f",
        "type": "ha-entity",
        "z": "cc1f7120.b3cab",
        "name": "HA Festoon Switch",
        "server": "dd09859.2795578",
        "version": 1,
        "debugenabled": false,
        "outputs": 2,
        "entityType": "switch",
        "config": [
            {
                "property": "name",
                "value": "Festoon Switch"
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "icon",
                "value": "mdi-flash"
            },
            {
                "property": "unit_of_measurement",
                "value": ""
            }
        ],
        "state": "payload",
        "stateType": "msg",
        "attributes": [],
        "resend": true,
        "outputLocation": "",
        "outputLocationType": "none",
        "inputOverride": "allow",
        "outputOnStateChange": true,
        "outputPayload": "$entity().state ? \"on\": \"off\"",
        "outputPayloadType": "jsonata",
        "x": 1010,
        "y": 160,
        "wires": [
            [
                "4b1bbbb01723025a"
            ],
            [
                "2edec79ded1cd812"
            ]
        ]
    },
    {
        "id": "4b1bbbb01723025a",
        "type": "lifx-set-state",
        "z": "cc1f7120.b3cab",
        "name": "lifx-set-state-on",
        "api": "5e36f9dd.8c4718",
        "selector": "label:LIFX Switch - Kitchen|0",
        "power": "on",
        "color": "",
        "brightness": "",
        "duration": "0",
        "infrared": "",
        "fast": "false",
        "x": 1200,
        "y": 140,
        "wires": []
    },
    {
        "id": "2edec79ded1cd812",
        "type": "lifx-set-state",
        "z": "cc1f7120.b3cab",
        "name": "lifx-set-state-off",
        "api": "5e36f9dd.8c4718",
        "selector": "label:LIFX Switch - Kitchen|0",
        "power": "off",
        "color": "",
        "brightness": "",
        "duration": "0",
        "infrared": "",
        "fast": "false",
        "x": 1200,
        "y": 180,
        "wires": []
    },
    {
        "id": "ae107d1486d0ac3f",
        "type": "change",
        "z": "cc1f7120.b3cab",
        "name": "state on",
        "rules": [
            {
                "t": "set",
                "p": "enable",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 820,
        "y": 240,
        "wires": [
            [
                "a43aa15a6b19abbb"
            ]
        ]
    },
    {
        "id": "4514c0ec075723af",
        "type": "switch",
        "z": "cc1f7120.b3cab",
        "name": "ensuite switch state",
        "property": "payload[12].relays.relays[2].power",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "on",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "off",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 630,
        "y": 260,
        "wires": [
            [
                "ae107d1486d0ac3f"
            ],
            [
                "d5846cf7f9362376"
            ]
        ]
    },
    {
        "id": "d5846cf7f9362376",
        "type": "change",
        "z": "cc1f7120.b3cab",
        "name": "state off",
        "rules": [
            {
                "t": "set",
                "p": "enable",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 820,
        "y": 280,
        "wires": [
            [
                "a43aa15a6b19abbb"
            ]
        ]
    },
    {
        "id": "a43aa15a6b19abbb",
        "type": "ha-entity",
        "z": "cc1f7120.b3cab",
        "name": "HA Ensuite Fan",
        "server": "dd09859.2795578",
        "version": 1,
        "debugenabled": false,
        "outputs": 2,
        "entityType": "switch",
        "config": [
            {
                "property": "name",
                "value": "Ensuite Fan"
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "icon",
                "value": "mdi-fan"
            },
            {
                "property": "unit_of_measurement",
                "value": ""
            }
        ],
        "state": "payload",
        "stateType": "msg",
        "attributes": [],
        "resend": true,
        "outputLocation": "",
        "outputLocationType": "none",
        "inputOverride": "allow",
        "outputOnStateChange": true,
        "outputPayload": "$entity().state ? \"on\": \"off\"",
        "outputPayloadType": "jsonata",
        "x": 1000,
        "y": 260,
        "wires": [
            [
                "e5d49e4a810b14db"
            ],
            [
                "f31d94025fce2ed3"
            ]
        ]
    },
    {
        "id": "e5d49e4a810b14db",
        "type": "lifx-set-state",
        "z": "cc1f7120.b3cab",
        "name": "lifx-set-state-on",
        "api": "5e36f9dd.8c4718",
        "selector": "label:LIFX Switch - Master Bath|2",
        "power": "on",
        "color": "",
        "brightness": "",
        "duration": "0",
        "infrared": "",
        "fast": "false",
        "x": 1200,
        "y": 240,
        "wires": []
    },
    {
        "id": "f31d94025fce2ed3",
        "type": "lifx-set-state",
        "z": "cc1f7120.b3cab",
        "name": "lifx-set-state-off",
        "api": "5e36f9dd.8c4718",
        "selector": "label:LIFX Switch - Master Bath|2",
        "power": "off",
        "color": "",
        "brightness": "",
        "duration": "0",
        "infrared": "",
        "fast": "false",
        "x": 1200,
        "y": 280,
        "wires": []
    },
    {
        "id": "d88932e9ad489540",
        "type": "change",
        "z": "cc1f7120.b3cab",
        "name": "state on",
        "rules": [
            {
                "t": "set",
                "p": "enable",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 820,
        "y": 340,
        "wires": [
            [
                "1ffc7ebba02022cc"
            ]
        ]
    },
    {
        "id": "108b03dc60b21da7",
        "type": "switch",
        "z": "cc1f7120.b3cab",
        "name": "guest bath switch state",
        "property": "payload[5].relays.relays[1].power",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "on",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "off",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 640,
        "y": 360,
        "wires": [
            [
                "d88932e9ad489540"
            ],
            [
                "3ebb2314ac2c34f3"
            ]
        ]
    },
    {
        "id": "3ebb2314ac2c34f3",
        "type": "change",
        "z": "cc1f7120.b3cab",
        "name": "state off",
        "rules": [
            {
                "t": "set",
                "p": "enable",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 820,
        "y": 380,
        "wires": [
            [
                "1ffc7ebba02022cc"
            ]
        ]
    },
    {
        "id": "1ffc7ebba02022cc",
        "type": "ha-entity",
        "z": "cc1f7120.b3cab",
        "name": "HA Guest Bath Fan",
        "server": "dd09859.2795578",
        "version": 1,
        "debugenabled": false,
        "outputs": 2,
        "entityType": "switch",
        "config": [
            {
                "property": "name",
                "value": "Guest Bath Fan"
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "icon",
                "value": "mdi-fan"
            },
            {
                "property": "unit_of_measurement",
                "value": ""
            }
        ],
        "state": "payload",
        "stateType": "msg",
        "attributes": [],
        "resend": true,
        "outputLocation": "",
        "outputLocationType": "none",
        "inputOverride": "allow",
        "outputOnStateChange": true,
        "outputPayload": "$entity().state ? \"on\": \"off\"",
        "outputPayloadType": "jsonata",
        "x": 1010,
        "y": 360,
        "wires": [
            [
                "2591a75dbc7a6aac"
            ],
            [
                "54c6e17c24e4f906"
            ]
        ]
    },
    {
        "id": "2591a75dbc7a6aac",
        "type": "lifx-set-state",
        "z": "cc1f7120.b3cab",
        "name": "lifx-set-state-on",
        "api": "5e36f9dd.8c4718",
        "selector": "label:LIFX Switch - Guest Bath|1",
        "power": "on",
        "color": "",
        "brightness": "",
        "duration": "0",
        "infrared": "",
        "fast": "false",
        "x": 1200,
        "y": 340,
        "wires": []
    },
    {
        "id": "54c6e17c24e4f906",
        "type": "lifx-set-state",
        "z": "cc1f7120.b3cab",
        "name": "lifx-set-state-off",
        "api": "5e36f9dd.8c4718",
        "selector": "label:LIFX Switch - Guest Bath|1",
        "power": "off",
        "color": "",
        "brightness": "",
        "duration": "0",
        "infrared": "",
        "fast": "false",
        "x": 1200,
        "y": 380,
        "wires": []
    },
    {
        "id": "ead160477cfdf792",
        "type": "debug",
        "z": "cc1f7120.b3cab",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 670,
        "y": 100,
        "wires": []
    },
    {
        "id": "8ab1fa3f08714286",
        "type": "rbe",
        "z": "cc1f7120.b3cab",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload[11].relays.relays[0].power",
        "topi": "topic",
        "x": 450,
        "y": 160,
        "wires": [
            [
                "1418bfb6f3f00c27",
                "ead160477cfdf792"
            ]
        ]
    },
    {
        "id": "4964329616c74427",
        "type": "rbe",
        "z": "cc1f7120.b3cab",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload[12].relays.relays[2].power",
        "topi": "topic",
        "x": 450,
        "y": 260,
        "wires": [
            [
                "4514c0ec075723af"
            ]
        ]
    },
    {
        "id": "bf22c9756d0c0269",
        "type": "rbe",
        "z": "cc1f7120.b3cab",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload[5].relays.relays[1].power",
        "topi": "topic",
        "x": 450,
        "y": 360,
        "wires": [
            [
                "108b03dc60b21da7"
            ]
        ]
    },
    {
        "id": "5e36f9dd.8c4718",
        "type": "lifx-config",
        "token": "ca9aea13de0cc7acae8567c1bd0d72bc915d3d811247e832c4f088291ba1516a"
    },
    {
        "id": "dd09859.2795578",
        "type": "server",
        "name": "Home Assistant",
        "version": 2,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": 30
    }
]```

Ohh, nice, local control/speed would be better than what I’m doing talking to LIFX cloud. I will check it out. Have you used, got code samples? :slight_smile:

Mine looks fairly similar:

Here is my config that uses Photons locally (scrubbed somewhat):

[
    {
        "id": "7825cb320d62c4f0",
        "type": "subflow",
        "name": "LIFX Relay Control",
        "info": "",
        "category": "",
        "in": [
            {
                "x": 180,
                "y": 160,
                "wires": [
                    {
                        "id": "c2ab5fd5b4de0c66"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 1520,
                "y": 160,
                "wires": [
                    {
                        "id": "380ac95e648efdd1",
                        "port": 0
                    },
                    {
                        "id": "92caf485cae5cbac",
                        "port": 0
                    }
                ]
            }
        ],
        "env": [
            {
                "name": "SERIAL",
                "type": "str",
                "value": "",
                "ui": {
                    "icon": "font-awesome/fa-hashtag",
                    "label": {
                        "en-US": "Serial"
                    },
                    "type": "input",
                    "opts": {
                        "types": [
                            "str"
                        ]
                    }
                }
            },
            {
                "name": "RELAY",
                "type": "num",
                "value": "",
                "ui": {
                    "icon": "font-awesome/fa-power-off",
                    "label": {
                        "en-US": "Relay"
                    },
                    "type": "input",
                    "opts": {
                        "types": [
                            "num"
                        ]
                    }
                }
            },
            {
                "name": "ACTION",
                "type": "str",
                "value": "",
                "ui": {
                    "icon": "font-awesome/fa-cogs",
                    "label": {
                        "en-US": "Action"
                    },
                    "type": "select",
                    "opts": {
                        "opts": [
                            {
                                "l": {
                                    "en-US": "Turn On"
                                },
                                "v": "ON"
                            },
                            {
                                "l": {
                                    "en-US": "Turn Off"
                                },
                                "v": "OFF"
                            },
                            {
                                "l": {
                                    "en-US": "Get State"
                                },
                                "v": "STATE"
                            }
                        ]
                    }
                }
            }
        ],
        "meta": {},
        "color": "#DDAA99",
        "status": {
            "x": 320,
            "y": 360,
            "wires": [
                {
                    "id": "9cb9fec478b9f1ce",
                    "port": 0
                }
            ]
        }
    },
    {
        "id": "c2ab5fd5b4de0c66",
        "type": "change",
        "z": "7825cb320d62c4f0",
        "name": "Parse Input",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$env('ACTION') = \"STATE\" ? \"STATE\" : \"POWER\"",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "serial",
                "pt": "msg",
                "to": "SERIAL",
                "tot": "env"
            },
            {
                "t": "set",
                "p": "relay",
                "pt": "msg",
                "to": "RELAY",
                "tot": "env"
            },
            {
                "t": "set",
                "p": "level",
                "pt": "msg",
                "to": "$env('ACTION') = \"ON\" ? 65535 : 0",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 350,
        "y": 160,
        "wires": [
            [
                "b5b5a2b555c740a7"
            ]
        ]
    },
    {
        "id": "b5b5a2b555c740a7",
        "type": "switch",
        "z": "7825cb320d62c4f0",
        "name": "Get/Set",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "STATE",
                "vt": "str"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 560,
        "y": 160,
        "wires": [
            [
                "061bcf0c85a020cc"
            ],
            [
                "0190e7355f8fa469"
            ]
        ]
    },
    {
        "id": "9cb9fec478b9f1ce",
        "type": "status",
        "z": "7825cb320d62c4f0",
        "name": "Status",
        "scope": null,
        "x": 160,
        "y": 360,
        "wires": [
            []
        ]
    },
    {
        "id": "92caf485cae5cbac",
        "type": "http request",
        "z": "7825cb320d62c4f0",
        "name": "Photons Request",
        "method": "PUT",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "http://172.30.32.1:6100/v1/lifx/command",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "senderr": false,
        "x": 1070,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "061bcf0c85a020cc",
        "type": "template",
        "z": "7825cb320d62c4f0",
        "name": "GetRPower",
        "field": "payload",
        "fieldType": "msg",
        "format": "json",
        "syntax": "mustache",
        "template": "{\n    \"command\": \"query\",\n    \"args\": {\n        \"matcher\": {\n            \"serial\": \"{{ serial }}\"\n        },\n        \"pkt_type\": \"GetRPower\",\n        \"pkt_args\": {\n            \"relay_index\": {{ relay }}\n        }\n    }\n}",
        "output": "json",
        "x": 850,
        "y": 120,
        "wires": [
            [
                "92caf485cae5cbac"
            ]
        ]
    },
    {
        "id": "0190e7355f8fa469",
        "type": "template",
        "z": "7825cb320d62c4f0",
        "name": "SetRPower",
        "field": "payload",
        "fieldType": "msg",
        "format": "json",
        "syntax": "mustache",
        "template": "{\n    \"command\": \"set\",\n    \"args\": {\n        \"matcher\": {\n            \"serial\": \"{{ serial }}\"\n        },\n        \"pkt_type\": \"SetRPower\",\n        \"pkt_args\": {\n            \"relay_index\": \"{{ relay }}\",\n            \"level\": \"{{ level }}\"\n        }\n    }\n}",
        "output": "str",
        "x": 850,
        "y": 200,
        "wires": [
            [
                "380ac95e648efdd1"
            ]
        ]
    },
    {
        "id": "380ac95e648efdd1",
        "type": "http request",
        "z": "7825cb320d62c4f0",
        "name": "Photons Request",
        "method": "PUT",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "http://172.30.32.1:6100/v1/lifx/command",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "senderr": false,
        "x": 1070,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "46c493d18e8cd05c",
        "type": "ha-entity",
        "z": "5119d80bfa178357",
        "name": "Front Door Downlights Switch",
        "server": "home-assistant-server",
        "version": 1,
        "debugenabled": false,
        "outputs": 2,
        "entityType": "switch",
        "config": [
            {
                "property": "name",
                "value": "Front Door Downlights Switch"
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "icon",
                "value": "mdi:lightbulb-outline"
            },
            {
                "property": "unit_of_measurement",
                "value": ""
            }
        ],
        "state": "payload",
        "stateType": "msg",
        "attributes": [],
        "resend": true,
        "outputLocation": "",
        "outputLocationType": "none",
        "inputOverride": "allow",
        "outputOnStateChange": true,
        "outputPayload": "$entity().state ? \"on\": \"off\"",
        "outputPayloadType": "jsonata",
        "x": 1030,
        "y": 240,
        "wires": [
            [
                "ef81c4dfc7c72e6b"
            ],
            [
                "7d8198f248a8b71a"
            ]
        ]
    },
    {
        "id": "4aad3669e38b4132",
        "type": "ha-entity",
        "z": "5119d80bfa178357",
        "name": "Garage Downlights Switch",
        "server": "home-assistant-server",
        "version": 1,
        "debugenabled": false,
        "outputs": 2,
        "entityType": "switch",
        "config": [
            {
                "property": "name",
                "value": "Garage Downlights Switch"
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "icon",
                "value": "mdi:lightbulb-outline"
            },
            {
                "property": "unit_of_measurement",
                "value": ""
            }
        ],
        "state": "payload",
        "stateType": "msg",
        "attributes": [],
        "resend": true,
        "outputLocation": "",
        "outputLocationType": "none",
        "inputOverride": "allow",
        "outputOnStateChange": true,
        "outputPayload": "$entity().state ? \"on\": \"off\"",
        "outputPayloadType": "jsonata",
        "x": 1040,
        "y": 340,
        "wires": [
            [
                "299303d955b75f79"
            ],
            [
                "a3706c3d27d21ee2"
            ]
        ]
    },
    {
        "id": "cae75332b7d21167",
        "type": "ha-entity",
        "z": "5119d80bfa178357",
        "name": "Guest Toilet Switch",
        "server": "home-assistant-server",
        "version": 1,
        "debugenabled": false,
        "outputs": 2,
        "entityType": "switch",
        "config": [
            {
                "property": "name",
                "value": "Guest Toilet Switch"
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "icon",
                "value": "mdi:lightbulb-outline"
            },
            {
                "property": "unit_of_measurement",
                "value": ""
            }
        ],
        "state": "payload",
        "stateType": "msg",
        "attributes": [],
        "resend": true,
        "outputLocation": "",
        "outputLocationType": "none",
        "inputOverride": "allow",
        "outputOnStateChange": true,
        "outputPayload": "$entity().state ? \"on\": \"off\"",
        "outputPayloadType": "jsonata",
        "x": 990,
        "y": 140,
        "wires": [
            [
                "153b0d8dc0e0b9d6"
            ],
            [
                "ff77395ed93fdec2"
            ]
        ]
    },
    {
        "id": "a3818ab064e09d42",
        "type": "subflow:7825cb320d62c4f0",
        "z": "5119d80bfa178357",
        "name": "Guest Toilet Relay 1",
        "env": [
            {
                "name": "SERIAL",
                "value": "d073d5XXXXXXc79",
                "type": "str"
            },
            {
                "name": "RELAY",
                "value": "1",
                "type": "num"
            },
            {
                "name": "ACTION",
                "value": "STATE",
                "type": "str"
            }
        ],
        "x": 390,
        "y": 140,
        "wires": [
            [
                "c8615899c28e15e5"
            ]
        ]
    },
    {
        "id": "7fa430acc3d474d4",
        "type": "inject",
        "z": "5119d80bfa178357",
        "name": "Check Photons",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "0.25",
        "topic": "",
        "payloadType": "date",
        "x": 120,
        "y": 140,
        "wires": [
            [
                "a3818ab064e09d42"
            ]
        ]
    },
    {
        "id": "153b0d8dc0e0b9d6",
        "type": "subflow:7825cb320d62c4f0",
        "z": "5119d80bfa178357",
        "name": "Turn Guest Relay 1 On",
        "env": [
            {
                "name": "SERIAL",
                "value": "d073d5XXXXXXc79",
                "type": "str"
            },
            {
                "name": "RELAY",
                "value": "1",
                "type": "num"
            },
            {
                "name": "ACTION",
                "value": "ON",
                "type": "str"
            }
        ],
        "x": 1320,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "ff77395ed93fdec2",
        "type": "subflow:7825cb320d62c4f0",
        "z": "5119d80bfa178357",
        "name": "Turn Guest Relay 1 Off",
        "env": [
            {
                "name": "SERIAL",
                "value": "d073d5XXXXXXc79",
                "type": "str"
            },
            {
                "name": "RELAY",
                "value": "1",
                "type": "num"
            },
            {
                "name": "ACTION",
                "value": "OFF",
                "type": "str"
            }
        ],
        "x": 1320,
        "y": 140,
        "wires": [
            []
        ]
    },
    {
        "id": "c8615899c28e15e5",
        "type": "change",
        "z": "5119d80bfa178357",
        "name": "Set State",
        "rules": [
            {
                "t": "set",
                "p": "enable",
                "pt": "msg",
                "to": "payload.results.d073d5XXXXXXc79.payload.level = 65535 ? true : false",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 600,
        "y": 140,
        "wires": [
            [
                "ba08ad8237d841c5"
            ]
        ]
    },
    {
        "id": "ba08ad8237d841c5",
        "type": "rbe",
        "z": "5119d80bfa178357",
        "name": "rbe",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "enable",
        "topi": "topic",
        "x": 790,
        "y": 140,
        "wires": [
            [
                "cae75332b7d21167"
            ]
        ]
    },
    {
        "id": "f50298d4f99c01f8",
        "type": "subflow:7825cb320d62c4f0",
        "z": "5119d80bfa178357",
        "name": "Front Door Relay 2",
        "env": [
            {
                "name": "SERIAL",
                "value": "d073d5XXXXXXXXXXX",
                "type": "str"
            },
            {
                "name": "RELAY",
                "value": "2",
                "type": "num"
            },
            {
                "name": "ACTION",
                "value": "STATE",
                "type": "str"
            }
        ],
        "x": 390,
        "y": 240,
        "wires": [
            [
                "370494d3e8b00946"
            ]
        ]
    },
    {
        "id": "370494d3e8b00946",
        "type": "change",
        "z": "5119d80bfa178357",
        "name": "Set State",
        "rules": [
            {
                "t": "set",
                "p": "enable",
                "pt": "msg",
                "to": "payload.results.d073d5XXXXXX.payload.level = 65535 ? true : false",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 600,
        "y": 240,
        "wires": [
            [
                "98609527376c6859"
            ]
        ]
    },
    {
        "id": "98609527376c6859",
        "type": "rbe",
        "z": "5119d80bfa178357",
        "name": "rbe",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "enable",
        "topi": "topic",
        "x": 790,
        "y": 240,
        "wires": [
            [
                "46c493d18e8cd05c"
            ]
        ]
    },
    {
        "id": "8966b6dcc88c3d46",
        "type": "subflow:7825cb320d62c4f0",
        "z": "5119d80bfa178357",
        "name": "Front Door Relay 3",
        "env": [
            {
                "name": "SERIAL",
                "value": "d073d5XXXXXX",
                "type": "str"
            },
            {
                "name": "RELAY",
                "value": "3",
                "type": "num"
            },
            {
                "name": "ACTION",
                "value": "STATE",
                "type": "str"
            }
        ],
        "x": 390,
        "y": 340,
        "wires": [
            [
                "f368fefb6ab96bbc"
            ]
        ]
    },
    {
        "id": "f368fefb6ab96bbc",
        "type": "change",
        "z": "5119d80bfa178357",
        "name": "Set State",
        "rules": [
            {
                "t": "set",
                "p": "enable",
                "pt": "msg",
                "to": "payload.results.d073d5XXXXXX.payload.level = 65535 ? true : false",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 600,
        "y": 340,
        "wires": [
            [
                "e70568b90cb9b724"
            ]
        ]
    },
    {
        "id": "e70568b90cb9b724",
        "type": "rbe",
        "z": "5119d80bfa178357",
        "name": "rbe",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "enable",
        "topi": "topic",
        "x": 790,
        "y": 340,
        "wires": [
            [
                "4aad3669e38b4132"
            ]
        ]
    },
    {
        "id": "ef81c4dfc7c72e6b",
        "type": "subflow:7825cb320d62c4f0",
        "z": "5119d80bfa178357",
        "name": "Turn Front Door Relay 2 On",
        "env": [
            {
                "name": "SERIAL",
                "value": "d073d5XXXXXX",
                "type": "str"
            },
            {
                "name": "RELAY",
                "value": "2",
                "type": "num"
            },
            {
                "name": "ACTION",
                "value": "ON",
                "type": "str"
            }
        ],
        "x": 1340,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "7d8198f248a8b71a",
        "type": "subflow:7825cb320d62c4f0",
        "z": "5119d80bfa178357",
        "name": "Turn Front Door Relay 2 Off",
        "env": [
            {
                "name": "SERIAL",
                "value": "d073d5XXXXXX",
                "type": "str"
            },
            {
                "name": "RELAY",
                "value": "2",
                "type": "num"
            },
            {
                "name": "ACTION",
                "value": "OFF",
                "type": "str"
            }
        ],
        "x": 1340,
        "y": 260,
        "wires": [
            []
        ]
    },
    {
        "id": "a3706c3d27d21ee2",
        "type": "subflow:7825cb320d62c4f0",
        "z": "5119d80bfa178357",
        "name": "Turn Front Door Relay 3 Off",
        "env": [
            {
                "name": "SERIAL",
                "value": "d073d5XXXXXX",
                "type": "str"
            },
            {
                "name": "RELAY",
                "value": "3",
                "type": "num"
            },
            {
                "name": "ACTION",
                "value": "OFF",
                "type": "str"
            }
        ],
        "x": 1340,
        "y": 380,
        "wires": [
            []
        ]
    },
    {
        "id": "299303d955b75f79",
        "type": "subflow:7825cb320d62c4f0",
        "z": "5119d80bfa178357",
        "name": "Turn Front Door Relay 3 On",
        "env": [
            {
                "name": "SERIAL",
                "value": "d073d5XXXXXX",
                "type": "str"
            },
            {
                "name": "RELAY",
                "value": "3",
                "type": "num"
            },
            {
                "name": "ACTION",
                "value": "ON",
                "type": "str"
            }
        ],
        "x": 1340,
        "y": 320,
        "wires": [
            []
        ]
    },
    {
        "id": "f556aff16f5e4bbc",
        "type": "inject",
        "z": "5119d80bfa178357",
        "name": "Check Photons",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "0.5",
        "topic": "",
        "payloadType": "date",
        "x": 120,
        "y": 240,
        "wires": [
            [
                "f50298d4f99c01f8"
            ]
        ]
    },
    {
        "id": "b9d5a3687079bda5",
        "type": "inject",
        "z": "5119d80bfa178357",
        "name": "Check Photons",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "1.5",
        "topic": "",
        "payloadType": "date",
        "x": 140,
        "y": 340,
        "wires": [
            [
                "8966b6dcc88c3d46"
            ]
        ]
    }
]

Hi, New to Home Assistant and node red. Can you give me some help with getting the lights into Home Assistant as entities and then triggering them.

What do you mean, “get them in”? If you’re using the Node-RED Addon and Custom Component, then all entities from Home Assistant are automatically available to Node-RED. You trigger them using a Call Service node that runs one of either the light.turn_on, light.turn_off, light.toggle or lifx.set_state service to perform specific actions.