Sending MQTT message to Saswell SEA802-Z01

  • Platform information:
    • Hardware: Raspberry Pi 3B
    • OS: Raspberry OS
    • Java Runtime Environment: openjdk version “11.0.9” 2020-10-20 LTS
    • openHAB version: openHAB 3.3.0 Release Build

Good afternoon, I’m new to OpenHAB and I need some guidance from the resident experts.

I have installed a Hama 00176592 TRV (Saswell SEA802-Z01) on my radiator. I can control it without any issue with the Zigbee2MQTT front-end, the problems are when I use OpenHAB to forge a message to be sent to the MQTT thing. The MQTT bridge works, I already have a smart plug which I can easily pilot. I could retrieve the local temperature (not without some hardship, and to be honest I’m not sure about the exact reason why I started getting the temperature after a while), but when it comes to piloting the heating setpoint (with a dimmer) and setting the away mode (with a switch) I have no success. I tried reading the messages from Zigbee2mqtt logs, but nothing seems to arrive. I tried to push messages manually with MQTT explorer and it works. I know that in order to set the setpoint I need to publish to zigbee2mqtt/[friendly_name]/set the following JSON:

{
  "current_heating_setpoint": "10.5"
}

But for some reason OpenHAB cannot produce it. I’m posting the code for my generic MQTT thing. Could you please explain me what I’m doing wrong?

UID: mqtt:topic:f8ad4646d7:f92c626426
label: Kids room thermostat
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:f8ad4646d7
location: Kids room
channels:
  - id: local_temperature
    channelTypeUID: mqtt:number
    label: Local Temperature
    description: ""
    configuration:
      unit: °C
      min: 0
      stateTopic: zigbee2mqtt/0x04cd15fffe33abcd
      transformationPattern: JSONPATH:$.local_temperature
      max: 50
  - id: current_heating_setpoint
    channelTypeUID: mqtt:number
    label: Current Heating Setpoint
    description: null
    configuration:
      unit: °C
      min: 5
      transformationPatternOut: JSONPATH:$.current_heating_setpoint
      max: 30
      commandTopic: zigbee2mqtt/0x04cd15fffe33abcd/set
      step: 0.5
      stateTopic: zigbee2mqtt/0x04cd15fffe33abcd/get
      transformationPattern: JSONPATH:$.current_heating_setpoint
  - id: away_mode
    channelTypeUID: mqtt:switch
    label: Away
    description: null
    configuration:
      commandTopic: zigbee2mqtt/0x04cd15fffe33abcd/set
      transformationPatternOut: JSONPATH:$.away_mode
      stateTopic: zigbee2mqtt/0x04cd15fffe33abcd/get
      transformationPattern: JSONPATH:$.away_mode

Thank you very much!

Use zigbee2mqtt/0x04cd15fffe33abcd/set/current_heating_setpoint as command topic and delete the transformationPatternOut

Same for away mode

1 Like

Thank you @Matze0211 , now I see something moving. However, no matter how I set the slider, now every message sets the current heating setpoint to 5. I tried to add formatBeforePublish: “%1f” but to no avail.

Also, in order to retrieve the status of the setpoint from zigbee2mqtt do I have to use zigbee2mqtt/0x04cd15fffe33abcd/get/current_heating_setpoint or is it sufficient to leave
zigbee2mqtt/0x04cd15fffe33abcd with tranformationPattern as “JSONPATH:*.current_heating_setpoint” ?

Thank you!

Starting from the end with your second question:

To get the current state, keep it as it is.

For your first question:
I would try to manually send a command update to the item (e.g. via rule or script) and test if in this case the correct value is send via mqtt.
It might be a issue with the dimmer or a widget and not with the item/thing configuration.

Also have a look into/share your log files…

I am not that good (yet) with OpenHAB rules, but I tried the following: with MQTT Explorer I sent manually to the topic

zigbee2mqtt/0x04cd15fffe33abcd/set/current_heating_setpoint

the following json:

{
  "current_heating_setpoint": "10.5"
}

and as a result, the heating setpoint on the device is set to 5. So defintely it’s mqtt that gets the payload wrong when I send to zigbee2mqtt/0x04cd15fffe33abcd/set/current_heating_setpoint instead of just zigbee2mqtt/0x04cd15fffe33abcd/set

Maybe something related to your localization, that the decimal is handled wrong?
What’s happening if you send 10,5 instead of 10.5 or just 10?

Also not sure if openhab will automatically add the unit to the mqtt message and if 10 or 10°C will therefore make a difference.

I’m not home, otherwise i could test it, as I have a similar setup

I tried manually sending every possible variation, but it always goes back to 5 (which is the minimum value)

Ah, I just read you previous post again.

If you publish to zigbee2mqtt/0x04cd15fffe33abcd/set than you need a json string like { "current_heating_setpoint": "10.5" }

However if you publish to zigbee2mqtt/0x04cd15fffe33abcd/set/current_heating_setpoint then do not publish the entire json but only the value itself.

From the z2m docs:

Without JSON

In case you don’t want to use JSON, publishing to zigbee2mqtt/[FRIENDLY_NAME]/set/state with payload ON is the same as publishing to zigbee2mqtt/[FRIENDLY_NAME]/set payload {"state": "ON"}.

Ok, this makes lots of sense now. Now, how do I just send the raw value from the OpenHAB configuration? Its just not clear to me how to form a message. Do I have to act on the mqtt bridge thing?

Remove the channel unit

I have similar setup and also configured a unit.

Without knowing the details from the log, it’s hard to guess.
Try to link a number item instead of a dimmer item.
You can still visualize the number item with a dimmer, but for the item itself I would go with a number type

1 Like

Apologies for the very dumb question, but what logs should I retrieve exactly?

Details around logging can be found here:

The log files will show potential errors and also show any change of an item, what’s helpful to investigate your issue

I managed to access the logs. Thanks @Matze0211

21:02:29.742 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'KidsRoomThermostat_CurrentHeatingSetpoint' changed from 30 to 16
21:02:29.744 [DEBUG] [mqtt.generic.AbstractMQTTThingHandler] - Successfully published value 0.16000000 to topic zigbee2mqtt/0x04cd15fffe33abcd/set/current_heating_setpoint

Apparently the submitted value is divided by 100. I guess this is rounded to 0, which then becomes 5 because it’s the minimum value for the property. In fact, I had set my item as a “Dimmer” item, which sends the percentage value. So I used a Number item, and changed the widget to a slider, and it works wonders. Thank you all for your help!

1 Like