I have the following Setup:
openHAB3 on Linux box
MQTT broker on another box
plus other devices.
Both are working well but I cannot get openhab to get topic updates.
The MQTT binding connects (check connections in the MQTT $SYS log and it shows the broker connecting or disconnect as I pause it).
I’ve created a MQTT Generic thing and added a channel but it just remains as NULL.
Any help would be greatly appreciated & lt me know what info you need to diagnose.
Matze0211
(Matthias)
2
Please post your thing configuration, log files and maybe the content of your mqtt message.
There is no generic answer why it stays null without any details
rossko57
(Rossko57)
3
Thi would need a stateTopic setting before any subscription happened; we do need to see your detailed settings.
Hi All,
Thank you for jumping on. Below are settings as requested:
This is reading the total power in watts of the solar array output. The state comes in as a number.
Broker
UID: mqtt:broker:0d264cdddd
label: MQTT Broker
thingTypeUID: mqtt:broker
configuration:
publickeypin: false
lwtQos: 0
clientID: openHAB
keepAlive: 60
secure: false
birthRetain: true
certificatepin: false
shutdownRetain: false
qos: 2
reconnectTime: 30000
host: x.x.x.x #(MQTT broker IP here)
lwtRetain: true
enableDiscovery: true
username: null
password: null
MQTT Generic Thing
UID: mqtt:topic:0d264cdddd:PVassist
label: Solar Assistant
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:0d264cdddd
location: Power Room
channels:
- id: SA_total_PV
channelTypeUID: mqtt:number
label: Total PV output
description: ""
configuration:
stateTopic: solar_assistant/total/pv_power
Logs
I haven’t included the full logs but the critical info I found is here:
2022-10-08 16:31:20.437 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Incoming payload '' not supported by type 'NumberValue'
I also tried string but haven’t found anything in the logs. Also the value should never be blank but a numerical value between 0 and 10000.
I get this whenever I stop & start the broker:
2022-10-09 18:20:16.750 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '172.16.0.107' with clientid openHAB
Matze0211
(Matthias)
5
As per your screenshot please change this to
stateTopic: solar_assistant/total/pv_power/state
2 Likes
You have got to be kidding me…
Yup. You’ve probably worked out this is my first time setting up / configuring MQTT.
I thought state was the title of the value, not the final level of topic. Something so simple.
Thank you so much @Matze0211 !!
1 Like