MQTT Send Command via GUI

Hello everyone,

for my heating I have an ESM-ESP bus running to read information and hopefully also write settings.

I also successfully use an MQTT broker. Reading values ​​works fine. Settings write but unfortunately not.
In the example here I want to write the target temperature, but somehow it doesn’t work that way. What am I doing wrong?

MQTT Topic:

{"datetime":"18.10.2022 21:20",
"intoffset":0,
"floordry":"off",
"dampedoutdoortemp":16.2,
"floordrytemp":0,
"building":"light",
"minexttemp":-12,
"wwmode":"own prog",
"wwcircmode":"own prog",
"wwchargeduration":45,
"wwextra1":0,
"wwdisinfectday":"mo",
"wwdisinfecttime":240,
"hc1":{"seltemp":23,
"mode":"auto",
"modetype":
"comfort","ecotemp":18,
"manualtemp":21,
"comforttemp":22,
"summertemp":19,
"designtemp":50,
"offsettemp":2,
"minflowtemp":25,
"maxflowtemp":60,
"roominfluence":0,
"roominflfactor":4,
"curroominfl":0,
"nofrostmode":
"outdoor",
"nofrosttemp":5,
"targetflowtemp":34
,"heatingtype":"radiator",
"summersetmode":"auto",
"summermode":"winter",
"controlmode":"weather compensated",
"program":
"prog 2",
"tempautotemp":23,
"fastheatup":0",
reducemode":"outdoor",
"noreducetemp":-31,
"reducetemp":5}}


I don’t know, what a “ESM-ESP” bus is…?
but the JSON you pasted is not valid, perhaps that’s the key:

...
...
"fastheatup":0",
reducemode":"outdoor",
...
the " should come after the , - like this:
"fastheatup":0,
"reducemode":"outdoor",

the JSONPATH-syntax seems alright though: $.hc1.seltemp should send 23 with a correct JSON.

The Json ist only a Copy from mqtt Explorer, its a Copy mistake. I added some breaks

Mhm unfortunatetly it doesnt Work with this config…

The esm-esp is a device a connected with my buderus heater to Access the device and read or write values.

It’s hard to tell exactly what’s going and hard to read. Please click on the “Code” tab and paste the code from there using code fences.

```
code goes here
```

Things I notice:

  • you should almost never have the same state topic (OH reads messages) and the same command topic (OH writes messages). This can easily result in infinite loops. Some devices will use MQTT in bad ways and reuse the same topic for both. I don’t know ems-esp as to whether they do that. But usually you’d have a state topic and a separate command topic.

  • It would be very unusual to have the same transformation on the incoming and outgoing messages. For the transform to work like that the data would have to be the same coming and going in which case, what’s the purpose of the transform? But this really doesn’t make sense. When you receive the incoming message the JSONPATH transformation strips out the $.hc1.seltemp value which means your Item gets set to just a Number. That means this Channel is linked to a Number Item. And that means to send a command to that Item, and therefore publish a message, the Outgoing Value is just going to be a Number. You can’t run a JSONPATH transformation on just a Number. If you need to send that whole big JSON as the message, this is definitely not going to work.

2 Likes

OK, thank you, this make Sense, so i must found Out which are the send commands…

This is the Thing Code:

UID: mqtt:topic:a7995e967d:d25c7dd23d
label: ESM-ESP
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:a7995e967d
channels:
  - id: status
    channelTypeUID: mqtt:string
    label: EMS Status
    description: ""
    configuration:
      stateTopic: ems-esp/status
  - id: outdoortemp
    channelTypeUID: mqtt:number
    label: Außentemperatur Boiler
    description: ""
    configuration:
      stateTopic: ems-esp/boiler_data
      transformationPattern: JSONPATH:$.outdoortemp
  - id: curflowtemp
    channelTypeUID: mqtt:number
    label: Vorlauf Temperatur
    description: ""
    configuration:
      stateTopic: ems-esp/boiler_data
      transformationPattern: jsonpath:$.curflowtemp
  - id: rettemp
    channelTypeUID: mqtt:number
    label: Ruecklauf Temperatur
    description: ""
    configuration:
      stateTopic: ems-esp/boiler_data
      transformationPattern: jsonpath:$.rettemp
  - id: burnstarts
    channelTypeUID: mqtt:number
    label: Brenner Starts
    description: ""
    configuration:
      stateTopic: ems-esp/boiler_data
      transformationPattern: jsonpath:$.burnstarts
  - id: heating_active
    channelTypeUID: mqtt:switch
    label: Heizen
    description: ""
    configuration:
      stateTopic: ems-esp/heating_active
      off: off
      on: on
  - id: tapwater_active
    channelTypeUID: mqtt:switch
    label: Warmwasser
    description: ""
    configuration:
      stateTopic: ems-esp/tapwater_active
      off: off
      on: on
  - id: selflowtemp
    channelTypeUID: mqtt:number
    label: Soll Vorlauftemperatur
    description: ""
    configuration:
      stateTopic: ems-esp/boiler_data
      transformationPattern: jsonpath:$.selflowtemp
  - id: curburnpow
    channelTypeUID: mqtt:dimmer
    label: Aktuelle Brenner Leistung
    description: ""
    configuration:
      transformationPattern: jsonpath:$.curburnpow
      stateTopic: ems-esp/boiler_data
  - id: seltemp
    channelTypeUID: mqtt:number
    label: Ausgewaehlte Raumtemperatur
    description: ""
    configuration:
      postCommand: false
      min: 17
      transformationPatternOut: jsonpath:$.hc1.seltemp
      max: 30
      commandTopic: ems-esp/thermostat_data
      stateTopic: ems-esp/thermostat_data
      transformationPattern: jsonpath:$.hc1.seltemp

Hi, ok i got it:

described here: EMS-ESP Documentation

here is the correct commandTopic…

  - id: seltemp
    channelTypeUID: mqtt:number
    label: Ausgewaehlte Raumtemperatur
    description: ""
    configuration:
      commandTopic: ems-esp/thermostat/seltemp
      postCommand: false
      min: 17
      stateTopic: ems-esp/thermostat_data
      transformationPattern: jsonpath:$.hc1.seltemp
      max: 30

thanks

1 Like