In my use case I need to send two attributes to a receiver (a high and a low value). I get both values in two seperate (retained) MQTT messages in two topics. If either attribute changes, I want to send both to the receiver, which expects both values at a time.
Can I read retained MQTT messages/values for a combined use case, so I know the other value, if I'm sending the command to the receiver?
current flow
[
{
"id": "b2f37f21.9ab948",
"type": "mqtt in",
"z": "a351eaa.aed7b98",
"name": "cmdSetChargingLimitAC",
"topic": "openHAB/master/Kia/cmdSetChargingLimitAC",
"qos": "2",
"datatype": "auto",
"broker": "4672ca10.309984",
"x": 120,
"y": 1040,
"wires": [
[
"aec97b9c.d2374"
]
]
},
{
"id": "c2674666.5d09",
"type": "mqtt in",
"z": "a351eaa.aed7b98",
"name": "cmdSetChargingLimitDC",
"topic": "openHAB/master/Kia/cmdSetChargingLimitDC",
"qos": "2",
"datatype": "auto",
"broker": "4672ca10.309984",
"x": 120,
"y": 1080,
"wires": [
[
"aec97b9c.d2374"
]
]
},
{
"id": "aec97b9c.d2374",
"type": "function",
"z": "a351eaa.aed7b98",
"name": "",
"func": "myLimit = {};\nmyLimit.fast = 80;\nmyLimit.slow = 80;\n\nif (msg.topic == \"openHAB/master/Kia/cmdSetChargingLimitAC\") {\n myLimit.slow = msg.payload;\n}\nif (msg.topic == \"openHAB/master/Kia/cmdSetChargingLimitDC\") {\n myLimit.fast = msg.payload;\n}\n\nmsg.payload = myLimit;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 320,
"y": 1060,
"wires": [
[
"f498274c.5833e",
"1f2b80e4.92a73f"
]
]
},
{
"id": "4672ca10.309984",
"type": "mqtt-broker",
"name": "Synology",
"broker": "192.168.xx.yy",
"port": "1883",
"clientid": "nodered",
"usetls": false,
"compatmode": false,
"keepalive": "60",
"cleansession": true,
"birthTopic": "openHAB/master/nodered",
"birthQos": "2",
"birthRetain": "true",
"birthPayload": "ON",
"closeTopic": "openHAB/master/nodered",
"closeQos": "2",
"closeRetain": "true",
"closePayload": "OFF",
"willTopic": "openHAB/master/nodered",
"willQos": "2",
"willRetain": "true",
"willPayload": "OFF"
}
]