nattila1
(nattila1)
September 10, 2023, 8:22am
1
Platform: RPI3 b+
OH 4.0.2 fresh Openhabian install
Java: 17
Hi,
I am struggling with setting up MQTT Things. I have some temperature sensors and their data is sent by my MySensors gateway via MQTT. I can read and attache temperature value to an Item easily, but whatever channel ID I set for other properties of the Thing I get Channel mqtt:topic:TempSensors:battery not supported!
warn and Item doesn’t receive data. So the first channel property works but the second doesn’t. I tried several changes without success. Could you please give me some guidance what I do wrong?
I confog MQTT based on this tutorial, and I can’t see significant differences between Things configs: MySensors without the binding (DHT22 over MQTT)
Moquitto get all messages, so that shouldn’t be an issue
Things definition
// MQTT Broker - MySensores
Bridge mqtt:broker:MySensorsMqttBroker [ host="127.0.0.1", port="1883", secure=false ]
// MQTT - MySensors temperature sensors
Thing mqtt:topic:TempSensors "Tempereature sensors" (mqtt:broker:MySensorsMqttBroker){
Channels:
Type number : temperature "Temperature" [
stateTopic="mysensors-gateway-out/27/0/1/0/0"
]
Type number : battery "Battery" [
stateTopic="mysensors-gateway-out/27/255/3/0/0"
]
}
Items definition
// Living Room
Number gf_living_heating_temp "Nappali" { channel="mqtt:topic:TempSensors:temperature" }
Number gf_living_heating_battery "Nappali battery [%d %%]" { channel="mqtt:topic:TempSensors:battery" }
What happens when you remove the [%d %%] ?
Maybe the changes to your Things files aren’t being picked up properly.
You can restart openHAB to see.
Or I do this .
denominator
(James Bowler)
September 10, 2023, 9:58pm
4
try
// MQTT Broker - MySensores
Bridge mqtt:broker:MySensorsMqttBroker [ host="127.0.0.1", port="1883", secure=false ]
// MQTT - MySensors temperature sensors
Thing mqtt:topic:TempSensors "Tempereature sensors" (mqtt:broker:MySensorsMqttBroker){
Channels:
Type number : temperature "Temperature" [ stateTopic="mysensors-gateway-out/27/0/1/0/0"]
Type number : battery "Battery" [stateTopic="mysensors-gateway-out/27/255/3/0/0"]
}
}
Thing UID should be like
mqtt:topic:MySensorsMqttBroker:TempSensors
and therefor the Channel UIDs should be
mqtt:topic:MySensorsMqttBroker:TempSensors:temperature
mqtt:topic:MySensorsMqttBroker:TempSensors:battery
If defining Things via text files, it’s more common to use hierarchic notation:
Bridge mqtt:broker:MySensorsMqttBroker [ // MQTT Broker - MySensores
host="127.0.0.1",
port=1883,
secure=false
] {
Thing topic TempSensors "Tempereature sensors" // MQTT - MySensors temperature sensors
{
Channels:
Type number : temperature "Temperature" [ stateTopic="mysensors-gateway-out/27/0/1/0/0" ]
Type number : battery "Battery" [ stateTopic="mysensors-gateway-out/27/255/3/0/0" ]
}
}
Please be aware that port is numeric and therefor you should not use quotes for the value.
1 Like
djpsycho82
(Jeroen de Vries)
September 11, 2023, 6:27am
6
I had this problem with items linked to Hue lights, removing the [%d %%] made the items work again.
nattila1
(nattila1)
September 12, 2023, 7:16pm
7
Hi,
Your suggestion solved the issue. I restarted the device and after a while it started to work.
Thank you,
Attila