Hello everybody. Ask you for help.
I have configured OH (2.5), partially via Paper UI, partially via configs, and it worked almost fine.
MQTT Binding, MQTT Things and its Channels, and Items were configured by Paper UI.
Sitemap, Persistence and Items were made in text configs (Items in config were duplicated from PaperUI).
Now I try to configure everything with configs only, and can’t get it to work, at the same time I do not get errors in logs. Tried this way and that, but cant get it up running.
I have added MQTT bridge definition and Things definition to config files and removed them in PaperUI.
Now it is configured as follows:
/etc/openhab2/things/default.things
Bridge mqtt:broker:pibroker [ host="192.168.0.99", secure=false, username="pi", password="mySuperSecurePasswordEver"]
{
Thing topic main_pi "Main Pi (Thing)" @ "Room" {
Channels:
String : uptime_channel [stateTopic="/home/pi/uptime"]
String : load_channel [stateTopic="/home/pi/loadaverage"]
String : cputemp_channel [stateTopic="/home/pi/temp"]
}
Thing topic kitchen_controller2 "Kitchen controller #2 (Thing)" @ "Kitchen" {
Channels:
Number : humidity_channel [stateTopic="/home/kitchen/hum"]
Number : temperature_channel [stateTopic="/home/kitchen/temp"]
Number : pressure_channel [stateTopic="/home/kitchen/pres"]
Switch : led_channel [stateTopic="/home/kitchen/led_info", commandTopic="/home/kitchen/led", on="1", off="0"]
String : msg_channel [stateTopic="/home/kitchen/msg"]
String : ip_channel [stateTopic="/home/kitchen/ip_address"]
String : firmware_channel [stateTopic="/home/kitchen/firmware_version"]
}
}
/etc/openhab2/items/room.items
String pi_uptime "Uptime" {channel="mqtt:topic:pibroker:main_pi:uptime_channel"}
String pi_load "Load average" {channel="mqtt:topic:pibroker:main_pi:load_channel"}
String pi_cputemp "CPU Temp" <temperature>{channel="mqtt:topic:pibroker:main_pi:cputemp_channel"}
/etc/openhab2/items/kitchen.items
String kitchen2_msg "Msg" { channel="mqtt:topic:pibroker:kitchen_controller2:msg_channel" }
String kitchen2_ip "Ip" { channel="mqtt:topic:pibroker:kitchen_controller2:ip_channel" }
String kitchen2_firmware "Firmware" { channel="mqtt:topic:pibroker:kitchen_controller2:firmware_channel" }
Number kitchen2_temperature "Temperature [%.1f °C]" <temperature> { channel="mqtt:topic:pibroker:kitchen_controller2:temperature_channel" }
Number kitchen2_humidity "Humidity [%.1f %%]" <humidity> { channel="mqtt:topic:pibroker:kitchen_controller2:humidity_channel" }
Switch kitchen2_led "LED" <light> ["Lighting", "Switchable", "Kitchen"] { channel="mqtt:topic:pibroker:kitchen_controller2:led_channel" }
Number kitchen2_pressure "Атмосферное давление [%.1f hPa]" <pressure> { channel="mqtt:topic:pibroker:kitchen_controller2:pressure_channel" }
/etc/openhab2/sitemaps/flat.sitemap
sitemap flat label="SmartestEverFlat" {
Frame label="Kitchen" {
Text item=kitchen2_msg label="Msg"
Text item=kitchen2_ip label="IP"
Text item=kitchen2_firmware label="Firmware"
Switch item=kitchen2_led icon="light"
Text item=kitchen2_temperature label="Temperature [%.1f °C]"
Chart item=kitchen2_temperature period=24h refresh=10000 service="jdbc"
Text item=kitchen2_humidity label="Humidity [%.1f %%]"
Chart item=kitchen2_humidity period=24h refresh=10000 service="jdbc"
Text item=kitchen2_pressure label="Pressure [%.1f hPa]"
}
Frame label="Main Pi" {
Text item=pi_cputemp label="CPU Temp"
Text item=pi_uptime label="Uptime"
Text item=pi_load label="Load average"
}
}
So I prepared configs, Logs looks well, no errors. But BasicUI shows nothing. I open PaperUI-> Configuration->Things->Main Pi (Thing) and I see there config-defined channels not linked to Items. I expected them to be already linked in .items config in {}. Well, I tap “linked Items +” href on each channel, and link Items manually (PaperUI show config-defined Items - its OK). Linked everything manually this way, blue circle changes (white dot inside) - connected ok. But BasicUI shows nothing.
I tried to get items value via REST API. API sends NULL in Item value. eg:
http://rpi162:8080/rest/items/kitchen2_temperature
Response Body
{
"link": "http://rpi162:8080/rest/items/kitchen2_temperature",
"state": "NULL",
"stateDescription": {
"pattern": "%.1f °C",
"readOnly": false,
"options": []
},
"editable": false,
"type": "Number",
"name": "kitchen2_temperature",
"label": "Temperature",
"category": "temperature",
"tags": [],
"groupNames": []
}
Response Code
200
(The same NULL for any Item in .items)
Mosquitto works well. I have checked:
└─[$] git:(master*) mosquitto_sub -v -t “/home/kitchen/#”
/home/kitchen/led_info 0
/home/kitchen/led 0
/home/kitchen/ip_address 192.168.0.103
/home/kitchen/msg mDNS responder started
/home/kitchen/firmware_version 2020-01-12/v0.2.2.4
/home/kitchen/temp 23
/home/kitchen/pres 1009
/home/kitchen/hum 41
What am I doing wrong, where is the error?
At least what is the normal way of debugging such cases in OH?
(Raspberry Pi, Openhab 2.5 upgraded from 2.4 installed via APT.)
Thanks for your help