Skip to content

Instantly share code, notes, and snippets.

@vigonotion
Created July 21, 2024 12:37
Show Gist options
  • Select an option

  • Save vigonotion/3474a6642cbfbe8f6ab208d5efe63399 to your computer and use it in GitHub Desktop.

Select an option

Save vigonotion/3474a6642cbfbe8f6ab208d5efe63399 to your computer and use it in GitHub Desktop.
[
{
"id": "dd8b1514.913318",
"type": "deduplicate",
"z": "af40457d.8bd3e",
"name": "[2] Deduplicate",
"keyproperty": "topic",
"expirypolicy": "keep",
"registryclass": "",
"noderole": "standalone",
"expiry": "600",
"x": 340,
"y": 140,
"wires": [
[
"24394d73.c81a5a"
],
[]
]
},
{
"id": "6f090c2d.999fcc",
"type": "server-state-changed",
"z": "af40457d.8bd3e",
"name": "[1] Someone comes 🏠",
"server": "e02cc9b7.16ead8",
"version": 1,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "person\\..*",
"entityidfiltertype": "regex",
"outputinitially": false,
"state_type": "str",
"haltifstate": "home",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 2,
"output_only_on_state_change": true,
"x": 140,
"y": 140,
"wires": [
[
"dd8b1514.913318"
],
[]
]
},
{
"id": "24394d73.c81a5a",
"type": "delay",
"z": "af40457d.8bd3e",
"name": "[3] Delay",
"pauseType": "delay",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 500,
"y": 140,
"wires": [
[
"5e85b3aa.412a7c"
]
]
},
{
"id": "5e85b3aa.412a7c",
"type": "function",
"z": "af40457d.8bd3e",
"name": "[4] Filter family",
"func": "let family = ['person.alice', 'person.bob', 'person.celine', 'person.dylan'];\nif(family.includes(msg.topic)) {\n node.status({fill:\"green\",shape:\"dot\",text:\"Family\"});\n return [msg, null];\n}\nnode.status({fill:\"green\",shape:\"dot\",text:\"Guest\"});\nreturn [null, msg];",
"outputs": 2,
"noerr": 0,
"x": 660,
"y": 140,
"wires": [
[
"f0158969.df06f8"
],
[]
],
"outputLabels": [
"Familie",
"Gäste"
]
},
{
"id": "f0158969.df06f8",
"type": "function",
"z": "af40457d.8bd3e",
"name": "[5] Build prompt",
"func": "\nmsg.payload = msg.topic.split(\".\")[1] + \" just came home.\";\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 180,
"y": 240,
"wires": [
[
"276b18.4b05f4e8"
]
]
},
{
"id": "276b18.4b05f4e8",
"type": "ha-api",
"z": "af40457d.8bd3e",
"name": "[6] Call conversation API",
"server": "e02cc9b7.16ead8",
"debugenabled": true,
"protocol": "http",
"method": "post",
"path": "/api/conversation/process",
"data": "{\t \"text\": payload,\t \"language\":\"de\",\t \"agent_id\": \"e6fa5dddd2a746bc762f1294acad1122\"\t}",
"dataType": "jsonata",
"location": "payload",
"locationType": "msg",
"responseType": "json",
"x": 390,
"y": 240,
"wires": [
[
"5de46c07.756814"
]
]
},
{
"id": "5de46c07.756814",
"type": "change",
"z": "af40457d.8bd3e",
"name": "[7] Set payload to API response",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.response.speech.plain.speech",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 650,
"y": 240,
"wires": [
[
"98b15fe8.4708a"
]
]
},
{
"id": "98b15fe8.4708a",
"type": "api-call-service",
"z": "af40457d.8bd3e",
"name": "[8] Trigger announcement",
"server": "e02cc9b7.16ead8",
"version": 1,
"debugenabled": false,
"service_domain": "notify",
"service": "alexa_media",
"entityId": "",
"data": "{\t \"data\":{\"type\":\"announce\",\"method\":\"all\"},\t \"message\": payload,\t \"target\":\"media_player.esszimmer\"\t}",
"dataType": "jsonata",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 910,
"y": 240,
"wires": [
[]
]
}
]
@ae8u
Copy link

ae8u commented Oct 11, 2024

I have followed your steps exactly, but apparently I have an error somewhere. And since it's just my wife and I, there aren't that many times for it to be triggered. Can you offer some debugging steps to help me find my error?

@1liminal1
Copy link

Did you get anywhere with this? I put my own version of the config though Claude and he helped get it working :)

I came here to ask about the new LLM streaming update in 2025.3.0 and if anyone has installed it yet, does it adversely affect your outputs to alexa?

Also, thanks for this idea Tom, Its very cool and really added some awesome new functionality.

I've also created a "health sensor" that collects sleep metics from my Withings scale and sleep mat. So alexa can tell me every morning how little sleep Im getting and how fat I am HAHA ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment