On smart speaker voice command collect retained topic value from MQTT server and speak it out

How do I collect a retained topic from the MQTT server and pass it to NORA.
eg "Hey Google, what is the boiler pressure."
I have the boiler pressure updated to the MQTT server every 2 mins.

I had an extensive play last night and could't figure it out.

why not have a flow that subscribes to the topic. Every time a msg comes in, update a context variable.

Then have the flow that responds to the question, retreive the context variable, build the sentence and pass it on.

Thanks.

ah, got something,

I can collect the retained topic from the MQTT server with the "MQTT in" node.
I know this becasue each time I re-deploy the debug pushes the retained topic value out to debug messages.

Haven't been able to establish how to get NORA to hold this value.

Anyone have a flow / script recipie?

Recipe? You just connect a Change node to the MQTT in node. In the Change node you set the context variable

1 Like

@andrei-tatar is it possible to query the MQTT server for a retained topic value and get a NORA node to relay the retained topic value through the google speaker.

eg "hey google, what is the fuel level"

Which of the NORA nodes if any would I use, it's not obvious to me which NORA node might do this, and how might this be achieved in terms of a flow?

@krambriw thanks,
everyone seems to indicate this is easy to do,
but no one seems able to say how easy steps are actually done.

When I google for this, my OP, above, is at the head of the search output.

I have used the change node as you suggest, but how to use a NORA node to effect this isn't clear.

Do you know which NORA node to use?

I've had a good look at them all, and so far, it's not obvious.

Share your flow to get best & fastest help so that the experts on your topic can help & suggest in best possible way. Changing words back & forth is just time consuming.

And once again, you do NOT query the MQTT broker. When you connect & subscribe with the MQTT in node (an MQTT client) you will receive the retained value AUTOMATICALLY. From this point, as long as you are connected & subscribe, you will get any changed value also AUTOMATICALLY. I recommend you read up on how MQTT works, I think if you search for hivmqtt they have a lot of good documents like MQTT essentials explaining the stuff

@krambriw

It's not a question of it not coming to the NORA node, becasue I see the

  • "MQTT in" node passing the topic value from the MQTT server,
  • to a change node,
  • through a NORA node and
  • to the debug node.

I see the topic value in the debug for the last flow node on the right. So it is not a question of the topic value not being passed through.

I think the question now is whether there is a nora node that can allow query of this value by voice.

[
    {
        "id": "547e030e.47f42c",
        "type": "mqtt in",
        "z": "f4f52213.9349f",
        "name": "fuel remaining",
        "topic": "/garage/keroscene_tank_%_REMAINING",
        "qos": "1",
        "datatype": "auto",
        "broker": "360de41d.c9f21c",
        "x": 90,
        "y": 860,
        "wires": [
            [
                "7b6775c5.ce0ddc",
                "b3dea6d4.677f98"
            ]
        ]
    },
    {
        "id": "335f4182.f383be",
        "type": "debug",
        "z": "f4f52213.9349f",
        "name": "MQTT_fuel_remaining 2",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 670,
        "y": 900,
        "wires": []
    },
    {
        "id": "5e86aa8a.322204",
        "type": "comment",
        "z": "f4f52213.9349f",
        "name": "MQTT test nodes",
        "info": "",
        "x": 100,
        "y": 800,
        "wires": []
    },
    {
        "id": "7b6775c5.ce0ddc",
        "type": "change",
        "z": "f4f52213.9349f",
        "name": "fuel remainig payload",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 340,
        "y": 860,
        "wires": [
            [
                "335f4182.f383be",
                "9b604e51.9879a"
            ]
        ]
    },
    {
        "id": "b3dea6d4.677f98",
        "type": "debug",
        "z": "f4f52213.9349f",
        "name": "MQTT_fuel_remaining 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 350,
        "y": 900,
        "wires": []
    },
    {
        "id": "c69dd8b5.6085a8",
        "type": "debug",
        "z": "f4f52213.9349f",
        "name": "MQTT_fuel_remaining_3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 950,
        "y": 860,
        "wires": []
    },
    {
        "id": "9b604e51.9879a",
        "type": "nora-blinds",
        "z": "f4f52213.9349f",
        "devicename": "fuel remaining",
        "roomhint": "",
        "name": "fuel remaining",
        "passthru": true,
        "invert": false,
        "nora": "fdb56117.e9cd",
        "topic": "",
        "x": 640,
        "y": 860,
        "wires": [
            [
                "c69dd8b5.6085a8"
            ]
        ]
    },
    {
        "id": "360de41d.c9f21c",
        "type": "mqtt-broker",
        "broker": "192.168.1.120",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": true,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    },
    {
        "id": "fdb56117.e9cd",
        "type": "nora-config",
        "name": "fuel remaining",
        "group": "fuel",
        "notify": false
    }
]

UPDATED

When a new value "arrives" from the mqtt in node, the change node takes the payload and store it in context in the "flow.fuel_remaining" variable

If you need that value you can simply get it as in the example below. So you would not query the mqtt broker for the value, you "ask" NR to provide you with the value stored in flow context

If you need help with NORA nodes, I know nothing about them


[{"id":"547e030e.47f42c","type":"mqtt in","z":"bf12ff9c.cd354","name":"fuel remaining","topic":"/garage/keroscene_tank_%_REMAINING","qos":"1","datatype":"auto","broker":"75eba16c.094f9","x":230,"y":290,"wires":[["7b6775c5.ce0ddc","b3dea6d4.677f98"]]},{"id":"335f4182.f383be","type":"debug","z":"bf12ff9c.cd354","name":"MQTT_fuel_remaining 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":810,"y":330,"wires":[]},{"id":"5e86aa8a.322204","type":"comment","z":"bf12ff9c.cd354","name":"MQTT test nodes","info":"","x":240,"y":230,"wires":[]},{"id":"7b6775c5.ce0ddc","type":"change","z":"bf12ff9c.cd354","name":"payload to \"fuel remaining\"","rules":[{"t":"set","p":"fuel_remaining","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":290,"wires":[["335f4182.f383be"]]},{"id":"b3dea6d4.677f98","type":"debug","z":"bf12ff9c.cd354","name":"MQTT_fuel_remaining 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":490,"y":330,"wires":[]},{"id":"c69dd8b5.6085a8","type":"debug","z":"bf12ff9c.cd354","name":"MQTT_fuel_remaining_3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1090,"y":290,"wires":[]},{"id":"37c5c3ed.7a7f4c","type":"inject","z":"bf12ff9c.cd354","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"75","payloadType":"num","x":220,"y":110,"wires":[["fd4e11b6.41cf3"]]},{"id":"fd4e11b6.41cf3","type":"mqtt out","z":"bf12ff9c.cd354","name":"","topic":"/garage/keroscene_tank_%_REMAINING","qos":"","retain":"true","broker":"75eba16c.094f9","x":520,"y":110,"wires":[]},{"id":"2facacd3.8dcfb4","type":"inject","z":"bf12ff9c.cd354","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"100","payloadType":"num","x":220,"y":150,"wires":[["fd4e11b6.41cf3"]]},{"id":"b5ff6241.e3c19","type":"inject","z":"bf12ff9c.cd354","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"30","payloadType":"num","x":220,"y":70,"wires":[["fd4e11b6.41cf3"]]},{"id":"4f7041de.eae36","type":"inject","z":"bf12ff9c.cd354","name":"Get value","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":230,"y":480,"wires":[["b588ab9e.a24a48"]]},{"id":"b588ab9e.a24a48","type":"change","z":"bf12ff9c.cd354","name":"\"fuel remaining\" to payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"fuel_remaining","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":480,"wires":[["2d3a121c.6f848e"]]},{"id":"2d3a121c.6f848e","type":"debug","z":"bf12ff9c.cd354","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":480,"wires":[]},{"id":"75eba16c.094f9","type":"mqtt-broker","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"online","birthQos":"0","birthPayload":"BULB-1/LWT","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"offline","willQos":"0","willPayload":"BULB-1/LWT"}]

I've asked the NORA maintainer.
I'm not sure NORA can do that atm, I will have to wait and see.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.