How to identify the commandTopic "name"

HI Y’all,

Probably an easy noob question, but couldn’t find the answer anywhere.

I’m setting up Zigbee Thermostat that are linked to a Sonoff ZBBridge (flashed with Tasmota, hence going through MQTT and therefore OpenHab).

I’ve been able to identify the “stateTopics”, by looking in my MQTT explorer and getting the proper names, but can’t figure out how to determine the name to use to send command to the thermostat.

Exemple, to read the SetPoint, I configured the following thing and items and it’s working just fine. I mean, If I chnage the setpoint on the thermostat, I can see the new setpoint value in OH.

Thing

Thing mqtt:topic:ThermoBureau "Thermostat Bureau" (mqtt:broker:MQTTBroker) @ "Bureau"  {
Channels:
    Type number : Temperature           "Temperature"           [stateTopic="tele/THERMO_BUREAU/SENSOR", transformationPattern ="JSONPATH:$.THERMO_BUREAU.Temperature" ]
    Type number : SetPoint              "SetPoint"              [stateTopic="tele/THERMO_BUREAU/SENSOR", transformationPattern ="JSONPATH:$.THERMO_BUREAU.OccupiedHeatingSetpoint" ]
    Type number : LocalTemperature      "LocalTemperature"      [stateTopic="tele/THERMO_BUREAU/SENSOR", transformationPattern ="JSONPATH:$.THERMO_BUREAU.LocalTemperature" ]
    Type number : TemperatureTolerance  "Tolerance"             [stateTopic="tele/THERMO_BUREAU/SENSOR", transformationPattern ="JSONPATH:$.THERMO_BUREAU.TemperatureTolerance" ]
    Type number : PIHeatingDemand       "Demande"               [stateTopic="tele/THERMO_BUREAU/SENSOR", transformationPattern ="JSONPATH:$.THERMO_BUREAU.PIHeatingDemand" ]
}

Items

// Thermostat Bureau
Number ThermoBureau_SetPoint                "SetPoint "                 <temperature>	(pBureau)    {channel="mqtt:topic:ThermoBureau:SetPoint"}
Number ThermoBureau_Temperature             "Temperature"               {channel="mqtt:topic:ThermoBureau:Temperature"}
Number ThermoBureau_LocalTemperature        "LocalTemperature"          {channel="mqtt:topic:ThermoBureau:LocalTemperature"}
Number ThermoBureau_TemperatureTolerance    "TemperatureTolerance"      {channel="mqtt:topic:ThermoBureau:TemperatureTolerance"}
Number ThermoBureau_PIHeatingDemand         "PIHeatingDemand"           {channel="mqtt:topic:ThermoBureau:PIHeatingDemand"}

Problem is, I don’t know what to put in CommandTopic… Probably something like

commandTopic="cmnd/THERMO_BUREAU/????"

But have no clue how to identify or where to look for.

Thanks for your help!

I don’t have a ZBBridge.

This is the info from the official doccumentation.

The format of the command is following:
ZbSend {“Device”:"",“Send”:{"":}} where
identifies the target and can be a shortaddr 0x1234, a longaddr 0x1234567812345678 or a friendly name Kitchen.
“”: is the command and its parameters from the table.
If the device has been correctly paired and its endpoints recorded by Z2T, you shouldn’t need to specify a target endpoint. You can use an option “endpoint”: parameter if Z2T can’t find the correct endpoint or if you want to change from the default endpoint.

So your cmnd topic will be

cmnd/THERMO_BUREAU/ZbSend

You need to figure out what to type into the tasmota console to get the device working

Something like ZbSend { "device":"<device>", "send":{"TempTargetSet":24} }

Then you just send the json string to the command topic

According to the Tasmota Zigbee docs there isn’t a supported command for setpoint.

For normal Tasmota it looks like there is a TempTargetSet command - maybe try that?

Does Z2T have a console like normal Tasmota? If so, what does it show if you manually change the setpoint of the device? I don’t use Z2T so that might be a completely ridiculous question!

Only a few people on these forums use Z2T, though there are more and more. However, I think the quickest help you’ll get is via the Tasmota Discord support.

1 Like

Thanks a lot for both your answers. They allowed me to make huge progress.

I went on the Tasmota discord and found out that the command I needed to send is:

ZbSend {"Device":"THERMO_BUREAU","Write":{"OccupiedHeatingSetpoint":20.5}}

Works perfectly when I write it in the Tasmota Console of the ZBBridge.

So I adjusted the commandTopic, but with no-luck. I think I might have a syntaz problem in mu formatBeforePublish…

Thing:

Thing mqtt:topic:ThermoBureau "Thermostat Bureau" (mqtt:broker:MQTTBroker) @ "Bureau"  {
Channels:
    Type number : SetPoint              "SetPoint"              [stateTopic="tele/THERMO_BUREAU/SENSOR", 
                                                                    transformationPattern ="JSONPATH:$.THERMO_BUREAU.OccupiedHeatingSetpoint", 
                                                                    commandTopic="cmnd/THERMO_BUREAU/ZbSend",
                                                                formatBeforePublish="{\"Device\":\"THERMO_BUREAU\",\"Write\":{\"OccupiedHeatingSetpoint\":%s}}"]

Item:

// Thermostat Bureau
Number ThermoBureau_SetPoint   "SetPoint "   <temperature>	(pBureau)    {channel="mqtt:topic:ThermoBureau:SetPoint"}

Sitemap:

sitemap default label="le 368"{

        Frame label="Pieces"{
                Group item=pBureau {
                        Frame label="Thermostat"{
                                Setpoint item=ThermoBureau_SetPoint
                       ...

When I modify the SetPoint on the app (sitemap), I see in the log that it is supposed to be happening,

2020-12-19 20:28:19.397 [ome.event.ItemCommandEvent] - Item 'ThermoBureau_SetPoint' received command 21.5

2020-12-19 20:28:19.415 [nt.ItemStatePredictedEvent] - ThermoBureau_SetPoint predicted to become 21.5

2020-12-19 20:28:19.439 [vent.ItemStateChangedEvent] - ThermoBureau_SetPoint changed from 20.5 to 21.5

2020-12-19 20:28:19.627 [ome.event.ItemCommandEvent] - Item 'ThermoBureau_SetPoint' received command 22.5

2020-12-19 20:28:19.642 [nt.ItemStatePredictedEvent] - ThermoBureau_SetPoint predicted to become 22.5

2020-12-19 20:28:19.668 [vent.ItemStateChangedEvent] - ThermoBureau_SetPoint changed from 21.5 to 22.5

but it doesn’t change on the thermostat, and I don’t see the command in the Tasmota console.

I have also tried creating a rule:

rule "Test"
 when
	Time cron "00 32 20 ? * MON-SAT *" 
 then
    //ThermoBureau_SetPoint.sendCommand(18)
    ThermoBureau_SetPoint.sendCommand("{\"Device\":\"THERMO_BUREAU\",\"Write\":{\"OccupiedHeatingSetpoint\":18}}")
 end

but I get that error in the log:

2020-12-19 20:32:00.283 [WARN ] [rthome.model.script.actions.BusEvent] - Cannot convert '{"Device":"THERMO_BUREAU","Write":{"OccupiedHeatingSetpoint":18}}' to a command type which item 'ThermoBureau_SetPoint' accepts: [DecimalType, QuantityType, RefreshType].

I copied your configuration into my setup, so that it looks like below. The only thing I changed is the reference to my Broker Thing, as mine is called MosquittoMqttBroker.

Thing

Thing mqtt:topic:ThermoBureau "Thermostat Bureau" (mqtt:broker:MosquittoMqttBroker) @ "Bureau"  {
Channels:
    Type number : SetPoint "SetPoint" [
        stateTopic="tele/THERMO_BUREAU/SENSOR",
        transformationPattern ="JSONPATH:$.THERMO_BUREAU.OccupiedHeatingSetpoint", 
        commandTopic="cmnd/THERMO_BUREAU/ZbSend",
        formatBeforePublish="{\"Device\":\"THERMO_BUREAU\",\"Write\":{\"OccupiedHeatingSetpoint\":%s}}"
    ]
}

Item

Number ThermoBureau_SetPoint "SetPoint " <temperature> (pBureau) {channel="mqtt:topic:ThermoBureau:SetPoint"}

Sitemap

Setpoint item=ThermoBureau_SetPoint

I change the Setpoint on the sitemap to 2:

image

I can see in MQTT Explorer that the expected string is sent to cmnd/THERMO_BUREAU/ZbSend
image

image

So for me at least the expected string is being sent to the expected topic, and makes it way all the way to my MQTT broker. Is your openHAB Broker Thing correctly configured? Is your device Thing pointing to the correct Broker Thing?

What did that show this time?

Note that you may have fallen victim to the annoying bug where openHAB sometimes doesn’t properly register changes made to Things files. You can restart openHAB, or do this.

1 Like

Thanks a lot. I believe that as you said, I was victim of the loading bug (second time this weekend. I will end up learning!).

Now that I have this working, I’m ready to tackle on more advanced stuff eith my thermostats. Do someone know how I could figure out the “item” that I can set on those thermostat. For exemple, I have been able to set the “setpoint” by sending a command for OccupiedHeatingSetpoint. Since those thermostat are not flashed, I believe these “names” were defined by the manufacturer. I was able to deduct this one, because the thermostat is also publishing it on a regular basis. But, for example, using the manufacturer gateway, I could see the Outside Temp on the thermostat. I’m sure I can push the value, but would need to figure out the name to send the command too. Same with the display. With the manufacturer gateway and app, I can setthe display on the thermostat to not be always-on. Don’t know how to find out the name to send the command to.

Are you still able to use the manufacturers gateway? If so, what happens when you command it from there - anything exciting in the Tasmota console, or MQTT Explorer?

I can use the manufacturer gateway, but I don’t think I can use it at the same time as the ZBBridge, the Thermostat can be linked to either the ZBBridge or the manuf gateway. Also, the manuf gateway is not on MQTT, so I doubt I’ll see something. But it is wort the try, will try tonight

That’s what I thought… to be able to connect a thermostat to the manufacturer gateway, I have to unpair it from my ZBBridge, hence, I cannot see anything in Tasmota/console, because it is not paired anymore.

Any idea how I could “read” or intercept what is being sent from the manufacturer gateway to the thermostat?

Try asking in the manufactures forum or read the manufacturer manual to find out what you need.

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