Help me with a simple flow

Hey guys i am new to home assistant but i am trying to learn quickly… in the last week i spent my time to get things properly in the groups and pages so now that it is done i am trying to play a bit with node red.

I am not trying to do anything fancy just to set an alexa command to turn on/off my pc i have verified that the switch works with the web ui and i cant seem to get it to work .

The debug message shows no errors at all but nothing happens when the command is triggered

Here is the code if anyone is interested

[{"id":"75cb830.b77fd7c","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"b0225800.03d3c8","type":"alexa-local","z":"75cb830.b77fd7c","devicename":"PC","inputtrigger":false,"x":130,"y":320,"wires":[["a6943937.cbbe38","558d3a1d.c46644"]]},{"id":"a6943937.cbbe38","type":"debug","z":"75cb830.b77fd7c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":170,"y":500,"wires":[]},{"id":"558d3a1d.c46644","type":"switch","z":"75cb830.b77fd7c","name":"On off","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"on","vt":"str","case":false},{"t":"regex","v":"off","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":2,"x":300,"y":320,"wires":[["4c1db09d.186db"],["e6b1f05d.d18ce"]]},{"id":"4c1db09d.186db","type":"api-call-service","z":"75cb830.b77fd7c","name":"Pc on","server":"ec9b32e7.6f96c","service_domain":"homeassistant","service":"turn_on","data":"{\"entity_id\":\"switch.windowsmarcos\"}","mergecontext":"","x":510,"y":260,"wires":[[]]},{"id":"e6b1f05d.d18ce","type":"api-call-service","z":"75cb830.b77fd7c","name":"Pc off","server":"ec9b32e7.6f96c","service_domain":"homeassistant","service":"turn_off","data":"{\"entity_id\":\"switch.windowsmarcos\"}","mergecontext":"","x":510,"y":340,"wires":[[]]},{"id":"ec9b32e7.6f96c","type":"server","z":"","name":"Home Assistant","url":"http://hassio/homeassistant","pass":"XXXXXXXX"}]

Looks like to me your switch is not setup correctly.

Change Domain from “homeassistant” to “SWTICH”

[
{
    "id": "e18ccd6c.c2edf",
    "type": "alexa-local",
    "z": "c8df258e.d44448",
    "devicename": "PC",
    "inputtrigger": false,
    "x": 130,
    "y": 320,
    "wires": [
        [
            "458c2289.42d05c",
            "944d6b5b.fd71e8"
        ]
    ]
},
{
    "id": "458c2289.42d05c",
    "type": "debug",
    "z": "c8df258e.d44448",
    "name": "",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "true",
    "x": 170,
    "y": 500,
    "wires": []
},
{
    "id": "944d6b5b.fd71e8",
    "type": "switch",
    "z": "c8df258e.d44448",
    "name": "On off",
    "property": "payload",
    "propertyType": "msg",
    "rules": [
        {
            "t": "regex",
            "v": "on",
            "vt": "str",
            "case": false
        },
        {
            "t": "regex",
            "v": "off",
            "vt": "str",
            "case": false
        }
    ],
    "checkall": "true",
    "repair": false,
    "outputs": 2,
    "x": 300,
    "y": 320,
    "wires": [
        [
            "6caccc41.75d184"
        ],
        [
            "cbf6ec12.a5b01"
        ]
    ]
},
{
    "id": "6caccc41.75d184",
    "type": "api-call-service",
    "z": "c8df258e.d44448",
    "name": "Pc on",
    "server": "54b06c8c.915ff4",
    "service_domain": "switch",
    "service": "turn_on",
    "data": "{\"entity_id\":\"switch.windowsmarcos\"}",
    "mergecontext": "",
    "x": 510,
    "y": 260,
    "wires": [
        []
    ]
},
{
    "id": "cbf6ec12.a5b01",
    "type": "api-call-service",
    "z": "c8df258e.d44448",
    "name": "Pc off",
    "server": "a87bd14d.5d8aa",
    "service_domain": "switch",
    "service": "turn_off",
    "data": "{\"entity_id\":\"switch.windowsmarcos\"}",
    "mergecontext": "",
    "x": 510,
    "y": 340,
    "wires": [
        []
    ]
},
{
    "id": "54b06c8c.915ff4",
    "type": "server",
    "z": "",
    "name": "Home Assistant",
    "url": "http://localhost:8123",
    "pass": "XXXXXX"
},
{
    "id": "a87bd14d.5d8aa",
    "type": "server",
    "z": "",
    "name": "Home Assistant 1",
    "url": "http://hassio/homeassistant",
    "pass": "XXXXXX"
}
]
1 Like

I just figured it out… the NET RPC Plugin was stopped XD it works perfect now… but i want to learn in which node do you want me to correct that information ???

You could hang some debugs out the back of each of the switch node outputs to see if it’s selecting something. You currently have them matching through RegEx, which will presumably work (I would have expected just ‘=’) - what are you getting in the payload of the debug? I don’t have Alexa, so don’t know what to expect. Also, have you successfully tested the call under the Services section of HA’s Developer Tools? FWIW, I tend to ensure switch nodes always select at least one option (eg. you could add an “otherwise” option to trap any unexpected behaviour).

1 Like

I put matched Regex because i read somewhere that for using alexa local i had to do it that way … i just switched to == and it works just fine… Yeah i had some derp moment and the RPC shutdown component wasnt running is all good now thank you for your reply