Page 1 of 1

[NodeRed][Alexa] Read Temperature

Posted: Wednesday 14 November 2018 11:20
by emme
Ciao,

I found a way to have Alexa access Domoticz Temp sensors and speaks.

To do so you will need: there is no cloud... the web site it is only needed to create device aliases, but all requests are only locally executed
than the flow will looks like the following
dzAlexaTempFlow.jpg
dzAlexaTempFlow.jpg (42.16 KiB) Viewed 6734 times
each device has been configured on the web site, than it is converted into a HTTP request and send back to alexa with the T value

The command is:
"Alexa, what's the temperature in <device>"
"Alexa, quale รจ la temperatura in <device>" (in italian :P)

it works like a charm! :P :P

Re: [NodeRed][Alexa] Read Temperature

Posted: Monday 13 May 2019 0:59
by sazubel
can you post the node-red code for this please?

Re: [NodeRed][Alexa] Read Temperature

Posted: Monday 13 May 2019 8:11
by emme
SURE!
here it is
change the node that reflect the assignment between the device and the domoticz IDX (will find mine inside)

Code: Select all

[
    {
        "id": "31fcbdb0.fb01f2",
        "type": "alexa-home-resp",
        "z": "11a271e9.04566e",
        "x": 690,
        "y": 210,
        "wires": []
    },
    {
        "id": "3643162d.05518a",
        "type": "http request",
        "z": "11a271e9.04566e",
        "name": "dz HTTP API",
        "method": "GET",
        "ret": "obj",
        "paytoqs": false,
        "url": "",
        "tls": "",
        "proxy": "",
        "x": 688.9998321533203,
        "y": 151.00006198883057,
        "wires": [
            [
                "d0fec16.5378c4"
            ]
        ]
    },
    {
        "id": "d0fec16.5378c4",
        "type": "function",
        "z": "11a271e9.04566e",
        "name": "create extra info key",
        "func": "var tDev = msg.payload.result[0].Temp;\n\nvar msg = {};\nmsg.extra = {\n    \"temperatureReading\": {\n        \"value\": tDev\n    },\n    \"applianceResponseTimestamp\": new Date().toISOString()\n};\n\nmsg.complete = true ;\nreturn msg; \n",
        "outputs": 1,
        "noerr": 0,
        "x": 909.9998931884766,
        "y": 151.00002574920654,
        "wires": [
            [
                "4110b038.fde5a"
            ]
        ]
    },
    {
        "id": "bf5a3308.6e4ef",
        "type": "alexa-home",
        "z": "11a271e9.04566e",
        "conf": "",
        "device": "36663",
        "acknoledge": false,
        "name": "",
        "topic": "",
        "x": 118.0000638961792,
        "y": 141.00002574920654,
        "wires": [
            [
                "e255d6a0.1e4b98",
                "3b861c2.7a083e4"
            ]
        ]
    },
    {
        "id": "e255d6a0.1e4b98",
        "type": "join",
        "z": "11a271e9.04566e",
        "name": "join",
        "mode": "custom",
        "build": "merged",
        "property": "",
        "propertyType": "full",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "num",
        "reduceFixup": "",
        "x": 316.0692882537842,
        "y": 209.28129291534424,
        "wires": [
            [
                "a2164003.04d81"
            ]
        ]
    },
    {
        "id": "4110b038.fde5a",
        "type": "delay",
        "z": "11a271e9.04566e",
        "name": "",
        "pauseType": "delay",
        "timeout": "50",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 1120.0694427490234,
        "y": 151.59035205841064,
        "wires": [
            [
                "e255d6a0.1e4b98"
            ]
        ]
    },
    {
        "id": "a2164003.04d81",
        "type": "function",
        "z": "11a271e9.04566e",
        "name": "fix payload key",
        "func": "delete msg.payload;\nmsg.payload = true;\nreturn msg; \n",
        "outputs": 1,
        "noerr": 0,
        "x": 480.0172805786133,
        "y": 210.0105104446411,
        "wires": [
            [
                "31fcbdb0.fb01f2"
            ]
        ]
    },
    {
        "id": "3b861c2.7a083e4",
        "type": "function",
        "z": "11a271e9.04566e",
        "name": "convert Alexa Name ==>   Domoticz IDX",
        "func": "var lnkUrl = \"http://127.0.0.1:8080/json.htm?type=devices&rid=\" ;\nvar reqRoom = msg.name;\n\n// JSON Links Device Name to Domoticz IDX\nvar map = {\n        \"Cucina\" :   7,\n          \"Sala\" :  17,\n        \"Camera\" : 323,\n     \"Cameretta\" : 297,\n      \"Bagnetto\" :   6,\n\"Cabina Armadio\" : 1947\n}\n\nvar msg = {};\nmsg.url = lnkUrl + map[reqRoom];\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 409.80870819091797,
        "y": 152.25370502471924,
        "wires": [
            [
                "3643162d.05518a"
            ]
        ]
    },
    {
        "id": "a3b2f58.2081508",
        "type": "alexa-home",
        "z": "11a271e9.04566e",
        "conf": "",
        "device": "36724",
        "acknoledge": false,
        "name": "",
        "topic": "",
        "x": 118.01741313934326,
        "y": 98.00007820129395,
        "wires": [
            [
                "e255d6a0.1e4b98",
                "3b861c2.7a083e4"
            ]
        ]
    },
    {
        "id": "705fc4f4.48bd7c",
        "type": "alexa-home",
        "z": "11a271e9.04566e",
        "conf": "",
        "device": "36725",
        "acknoledge": false,
        "name": "",
        "topic": "",
        "x": 117.01741313934326,
        "y": 181.00007343292236,
        "wires": [
            [
                "e255d6a0.1e4b98",
                "3b861c2.7a083e4"
            ]
        ]
    },
    {
        "id": "5f3b1c4b.605a64",
        "type": "alexa-home",
        "z": "11a271e9.04566e",
        "conf": "",
        "device": "36726",
        "acknoledge": false,
        "name": "",
        "topic": "",
        "x": 118.0173978805542,
        "y": 224.00012874603271,
        "wires": [
            [
                "e255d6a0.1e4b98",
                "3b861c2.7a083e4"
            ]
        ]
    },
    {
        "id": "c32a6fd8.da171",
        "type": "alexa-home",
        "z": "11a271e9.04566e",
        "conf": "",
        "device": "36728",
        "acknoledge": false,
        "name": "",
        "topic": "",
        "x": 117.01738262176514,
        "y": 266.00009059906006,
        "wires": [
            [
                "e255d6a0.1e4b98",
                "3b861c2.7a083e4"
            ]
        ]
    },
    {
        "id": "f841f0c8.a958d",
        "type": "comment",
        "z": "11a271e9.04566e",
        "name": "TEMPERATURE",
        "info": "",
        "x": 181.07643127441406,
        "y": 51.7327184677124,
        "wires": []
    },
    {
        "id": "d4d8f7df.921188",
        "type": "alexa-home",
        "z": "11a271e9.04566e",
        "conf": "",
        "device": "49385",
        "acknoledge": false,
        "name": "",
        "topic": "",
        "x": 81.91392517089844,
        "y": 314.7294874191284,
        "wires": [
            [
                "e255d6a0.1e4b98",
                "3b861c2.7a083e4"
            ]
        ]
    }
]

Re: [NodeRed][Alexa] Read Temperature

Posted: Sunday 08 December 2019 12:44
by gohan
Are you guys still able to use it? I can't find a way to make it work

Re: [NodeRed][Alexa] Read Temperature

Posted: Sunday 08 December 2019 12:59
by gizmocuz

Re: [NodeRed][Alexa] Read Temperature

Posted: Sunday 04 December 2022 19:14
by frank666
I wanted to have alexa read the energy and outdoor temperature sensors vocally , the system that @emme uses in the post above would be interesting but it doesn't seem to work ; I also put debugs in the process but it doesn't seem to activate,i don't want to use cloud services .I have node-red 3.0.2 on docker [/attachment]

Re: [NodeRed][Alexa] Read Temperature

Posted: Friday 30 December 2022 18:58
by zuputrus
frank666 wrote: Sunday 04 December 2022 19:14 I wanted to have alexa read the energy and outdoor temperature sensors vocally , the system that @emme uses in the post above would be interesting but it doesn't seem to work ; I also put debugs in the process but it doesn't seem to activate,i don't want to use cloud services .I have node-red 3.0.2 on docker [/attachment]
For me the flow works perfectly. Have you password on your domoticz? If so, try to put it into "dz HTTP API" node in "use authentication".
If not, try to put a debug node after each node and tell us what messages you have.

Re: [NodeRed][Alexa] Read Temperature

Posted: Saturday 31 December 2022 8:54
by frank666
@zuputrus,
I solved by having nodered read the MQTT messages .Thanks