Question - Is it possible to get a response silently
th3jesta opened this issue · 4 comments
I would like to use Hass.io to ask the temperature of a specific thermostat and display the result on a Lovelace card on a dashboard, with no response being played on any Google speaker. Is this theoretically possible? Ideally, I could get a JSON response back, parse it for the result, and display it on a card.
I'm also interested in this, currently getting only audio response is not very useful. Is there a way to get text response instead?
@JOHLC AMAZING job, I'm so happy I found this solution, could you possibly share some of the details in the nodered wiring you did and the api calls you made to save me time from testing on my own. Thanks again!
@ronpotter271
Here is an example set of nodes. You should be able to import them and play around.
[{
"id": "4b5140efe120c7a8",
"type": "function",
"z": "a17e91a494b7f357",
"name": "broadcast",
"func": "msg.type = \"broadcast\";\nmsg.message = msg.payload;\nmsg.payload = {\n \"command\": msg.message,\n \"user\": \"Home Assistant\",\n \"broadcast\": true\n};\n\nmsg.headers = {};\nmsg.headers['Content-Type'] = 'application/json';\n\nreturn msg;\n\n\n/// \"command\": \"{{{\" + msg.message + \"}}}\",\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1035,
"y": 340,
"wires": [["1c904a646bc22f59"]],
"l": false
}, {
"id": "576fa29c16c2b160",
"type": "function",
"z": "a17e91a494b7f357",
"name": "cmd",
"func": "msg.message = msg.payload;\nmsg.type = \"command\";\nmsg.payload = {\n \"command\": msg.message,\n \"user\": \"Home Assistant\",\n \"broadcast\": false\n};\nmsg.headers = {};\nmsg.headers['Content-Type'] = 'application/json';\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1035,
"y": 390,
"wires": [["1c904a646bc22f59"]],
"l": false
}, {
"id": "1c904a646bc22f59",
"type": "delay",
"z": "a17e91a494b7f357",
"name": "Limit",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "5",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 1115,
"y": 370,
"wires": [["e130c8fa9935e281"]],
"l": false
}, {
"id": "2f966aaef5e57e24",
"type": "delay",
"z": "a17e91a494b7f357",
"name": "30s",
"pauseType": "delay",
"timeout": "30",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 1355,
"y": 420,
"wires": [["f805184dc2db8859"]],
"l": false
}, {
"id": "f805184dc2db8859",
"type": "change",
"z": "a17e91a494b7f357",
"name": "off",
"rules": [{
"t": "set",
"p": "payload.text",
"pt": "msg",
"to": "off",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1405,
"y": 420,
"wires": [["29a9776484649b45"]],
"l": false
}, {
"id": "29a9776484649b45",
"type": "ha-entity",
"z": "a17e91a494b7f357",
"name": "Resp",
"server": "e983f1b0.9caca",
"version": 1,
"debugenabled": false,
"outputs": 1,
"entityType": "sensor",
"config": [{
"property": "name",
"value": "Google Assistant response"
}, {
"property": "device_class",
"value": ""
}, {
"property": "icon",
"value": "mdi:google-assistant"
}, {
"property": "unit_of_measurement",
"value": ""
}
],
"state": "payload.text",
"stateType": "msg",
"attributes": [],
"resend": true,
"outputLocation": "",
"outputLocationType": "none",
"inputOverride": "allow",
"outputOnStateChange": false,
"outputPayload": "",
"outputPayloadType": "str",
"x": 1540,
"y": 380,
"wires": [[]]
}, {
"id": "4f6c49323bf47005",
"type": "inject",
"z": "a17e91a494b7f357",
"name": "Command",
"props": [{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "Test",
"payloadType": "str",
"x": 870,
"y": 400,
"wires": [["576fa29c16c2b160"]]
}, {
"id": "c9a0cd95aa568dfa",
"type": "inject",
"z": "a17e91a494b7f357",
"name": "broadcast",
"props": [{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "Test",
"payloadType": "str",
"x": 870,
"y": 340,
"wires": [["4b5140efe120c7a8"]]
}, {
"id": "ca2e8de5a7a240a7",
"type": "function",
"z": "a17e91a494b7f357",
"name": "Route",
"func": "if (msg.type == \"broadcast\"){\n if (msg.volset == \"set\"){\n return [msg, null]\n }\n}\n\nif (msg.type == \"command\"){\n return [null, msg]\n}\n",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1265,
"y": 370,
"wires": [[], ["2f966aaef5e57e24", "29a9776484649b45"]],
"l": false
}, {
"id": "e130c8fa9935e281",
"type": "http request",
"z": "a17e91a494b7f357",
"name": "API",
"method": "POST",
"ret": "obj",
"paytoqs": "ignore",
"url": "http://haipaddress:3000/api/assistant",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"senderr": false,
"x": 1190,
"y": 370,
"wires": [["ca2e8de5a7a240a7"]]
}
]