I try to get work my new Shelly Plus H&T with Openhab. Because the old Shelly binding failed to communicate with the device (the whole time in sleep mode) and the new Shelly binding is failed to install i decided to give a try to the MQTT.
I newer worked with MQTT before. I installed the Binding. Made a mqqt.things file, where i wrote:
Bridge mqtt:broker:mosquitto [ host="192.168.100.111",port="1883", secure=false ]
{
Thing topic PlusHT1 "PlusHT1" {
Channels:
Type number : S_PlHT1_Batt "Shelly Plus HT1 Battery" [ stateTopic="shellyplusht-7c87ce6bd1b0/status/devicepower:0", transformationPattern="JSONPATH:$.battery.percent"]
Type number : S_PlHT1_Humi "Shelly Plus HT1 Humidity" [ stateTopic="shellyplusht-7c87ce6bd1b0/status/humidity:0", transformationPattern="JSONPATH:$.rh"]
Type number : S_PlHT1_Temp "Shelly Plus HT1 Temperatur" [ stateTopic="shellyplusht-7c87ce6bd1b0/status/temperature:0", transformationPattern="JSONPATH:$.tC"]
Type number : S_PlHT1_rssi "Shelly Plus HT1 RSSI" [ stateTopic="shellyplusht-7c87ce6bd1b0/status/wifi", transformationPattern="JSONPATH:$.rssi"]
}
Bridge mqtt:broker:mosquitto [ host="localhost",secure=false, username="XXXXX", password="XXXXXXXXXXXXXXXXX" ]{
Thing topic ShellyPlusHT "Shelly Plus H&T" {
Channels:
Type number : ShellyPlusHT_Battery "Shelly Plus HT1 Battery" [ stateTopic="shellyplusht-7c87ce6bd1b0/status/devicepower:0", transformationPattern="JSONPATH:$.battery.percent"]
Type number : ShellyPlusHT_Humidity "Shelly Plus HT1 Humidity" [ stateTopic="shellyplusht-7c87ce6bd1b0/status/humidity:0", transformationPattern="JSONPATH:$.rh"]
Type number : ShellyPlusHT_Temperature "Shelly Plus HT1 Temperatur" [ stateTopic="shellyplusht-7c87ce6bd1b0/status/temperature:0", transformationPattern="JSONPATH:$.tC"]
Type number : ShellyPlusHT_RSSI "Shelly Plus HT1 RSSI" [ stateTopic="shellyplusht-7c87ce6bd1b0/status/wifi", transformationPattern="JSONPATH:$.rssi"]
}
}
mqtt.items
Group:Number:SUM ShellyPlusHT "Shelly Plus H&T Bedroom (MQTT)" <settings> ["Sensor"]
Number ShellyPlusHT_Humidity "Bedroom MQTT Humidity [%.0f %%]" <humidity> (ShellyPlusHT) ["Humidity","Measurement"] { channel="mqtt:topic:mosquitto:ShellyPlusHT:ShellyPlusHT_Humidity" }
Number ShellyPlusHT_Temperature "Bedroom MQTT Temperatur [%.1f]" <temperature> (ShellyPlusHT) ["Temperature","Measurement"] { channel="mqtt:topic:mosquitto:ShellyPlusHT:ShellyPlusHT_Temperature" }
Number ShellyPlusHT_RSSI "Bedroom MQTT rssi [%.0f]" <cwifi> (ShellyPlusHT) ["Frequency"] { channel="mqtt:topic:mosquitto:ShellyPlusHT:ShellyPlusHT_RSSI" }
Number ShellyPlusHT_Battery "Bedroom MQTT Battery [%.0f %%]" <batterylevel> (ShellyPlusHT) ["Battery","Measurement"] { channel="mqtt:topic:mosquitto:ShellyPlusHT:ShellyPlusHT_Battery" }
You need to exchange the fixed part for your H&T HomeControl/Ambient1 and use your mqtt broker instead mine MqttBrokerMillipede
Once you have created the config be patient until the mqtt messages come out.
For debugging you can listen to the messages of your mqtt broker, you should see messages like this:
You can use for example mosquitto_sub for command line or MQTT-Explorer.
The messages are send out only on change depending on the thresholds you did setup in the device. I did set mine to 1 degree change for temperature and 2 percent for humidity.
During initial setup I was struggling when the device was powered with rechargeable Batteries, once I used USB Power instead I was able to join the device in my wifi and do the configuration.
Now it is running on normal batteries reliable.