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?
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” ?
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.
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
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?
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
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!