Hey there
I´m currently trying to set up my OpenHAB system, but it doesn´t work properly and unfortunately I have no idea what I´m doing wrong
I hope someone can help me with this…
I have four MQTT topics which I want to subscribe to and display the last (retained) value and also want to be able to publish to those topics.
So I set up items which display the current value.
I set up my defaul.items as followed:
String testVal1 "Value1 [%s]" <house> { mqtt="<[mymosquitto:test/val1:state:default]" }
String testVal2 "Value2 [%s]" <house> { mqtt="<[mymosquitto:test/val2:state:default]" }
Number testVal3 "Value3 [%d]" <house> { mqtt="<[mymosquitto:test/val3:state:default]" }
Number testVal4 "Value4 [%d]" <house> { mqtt="<[mymosquitto:test/val4:state:default]" }
And the default.sitemap:
sitemap default label="Main Menu"
{
Frame label="Test" {
Text item=testVal1
Text item=testVal2
Text item=testVal3
Text item=testVal4
}
}
If I look at the openhab.app I see the test values I published:
(Values 2 and 4 are set to “retain”, Values 1 and 3 are not retained)
And I also get messages in the console that the items were updated to my published values…
After that I wanted to add a pushbutton which publishes a value to a topic:
Items: Switch testSwitch1 "Set Value1" <house> { mqtt=">[mymosquitto:test/val1:command:*:test_val]", autoupdate="false"}
Sitemap: Switch item=testSwitch1
But as soon I add this Switch item, most my values are no longer displayed - they only show a “-” as value…
Also if I delete my switch item, it still no longer displays my values. I have to restart OpenHAB to get the values displayed again…
-> I don´t know how to fix this?!
-> I wan´t to be able to choose from a few predefined values for my topics, is it possible to implement a drop-down menu to select the value to be published?
I hope someone can help me with that… Thank you in advance!
Best regards