Hi,
I`m experiencing problem with the items file. I just cant get it to turn on and off the relay. Here is what I have writen in the file:
Switch Livingroom_light “Livingroom Light” {mqtt=<[broker:House/Livingroom/Light:command:ON:ON],>[broker:House/Livingroom/Light:command:OFF:OFF]" }
Everything else is configured fine, when i type the command manualy i can triger the ralay but i cant do nothing from openhab.
I`ve also configured a test sitemap file and i get the switch on the screen but it does noting.
I still dont get it mqttsw1 shoud be the topic or just an item name? The other problem is that my relay always turns on when i start the esp and the ON/OFF commands are reversed when i test it manualy and through openhab it still doesent work.
Well i fixed the reversed ON/OFF functions, but i still can make the switch ion my openhab interface to work.
Here is the contents of the items file:
Switch House/Livingroom/Light “Switch 1” (all) {mqtt=">[mosquitto:/House/Livingroom/Light:command:OFF:0], >[mosquitto:/House/Livingroom/Light:command:ON:1],#<[mosquittsquitto:/House/Livingroom/Light:state:default]"}
And the sitemap file:
sitemap home label=“LYNX Smart Home”
{
Frame label=“Light”
{
Switch item=House/Livingroom/Light
}
}
Thanks for the advice! But still it wont work. Mqtt is configured properly if i subscribe using mqtt.fx and send commands it works. The sitemap i corect i think, but i`m having no luck geting the switch to work.
I`m having no luck with this thing if somebody can help me with this mistery?
This is the items file
Switch House_Livingroom_Light “Switch 1” (all) {mqtt=">[mosquitto:House/Livingroom/Light:command:OFF:OFF], >[mosquitto:House/Livingroom/Light:command:ON:ON], <[mosquitosquitosquittsquitto:House/Livingroom/Light:state:default]"}
In your first post, you used “brojer” as the name of your Matt broker, in all following post you copied the name “mosquitto”. Which name did you a sign to your Matt broker in the first place?
Im new to openhab and im not quite shure where to asign a name to the broker. I saw in mqtt-eventbus.cfg that it says MQTT. Is there another config file i need to edit? Where is it located?
Define your MQTT broker connections here for use in the MQTT Binding or MQTT
Persistence bundles. Replace with an ID you choose.
URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
.url=tcp://localhost:1883
Optional. Client id (max 23 chars) to use when connecting to the broker.
If not provided a random default is generated.
#.clientId=openhab
Optional. True or false. If set to true, allows the use of clientId values
up to 65535 characters long. Defaults to false.
NOTE: clientId values longer than 23 characters may not be supported by all
MQTT servers. Check the server documentation.
#.allowLongerClientIds=false
Optional. User id to authenticate with the broker.
#.user=esp
Optional. Password to authenticate with the broker.
#.pwd=8266
Optional. Set the quality of service level for sending messages to this broker.
Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2
(Deliver exactly once). Defaults to 0.
#.qos=
Optional. True or false. Defines if the broker should retain the messages sent to
it. Defaults to false.
.retain=true
Optional. True or false. Defines if messages are published asynchronously or
synchronously. Defaults to true.
.async=false
Optional. Defines the last will and testament that is sent when this client goes offline
Format: topic:message:qos:retained
#.lwt=
I ve commented off the user and the password on purpose because im not using them. From Mqtt fx i connect to the server, i subscirbe, then from the publish tab: House/Livingroom/Light and in the message box i type ON and OFF which successfuly trigers the relay. the file does not show up well before every line there should be
#
# Define your MQTT broker connections here for use in the MQTT Binding or MQTT
# Persistence bundles. Replace <broker> with an ID you choose.
#
# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
<broker>.url=tcp://localhost:1883
# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a random default is generated.
#<broker>.clientId=openhab
# Optional. True or false. If set to true, allows the use of clientId values
# up to 65535 characters long. Defaults to false.
# NOTE: clientId values longer than 23 characters may not be supported by all
# MQTT servers. Check the server documentation.
#<broker>.allowLongerClientIds=false
# Optional. User id to authenticate with the broker.
#<broker>.user=esp
# Optional. Password to authenticate with the broker.
#<broker>.pwd=8266
# Optional. Set the quality of service level for sending messages to this broker.
# Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2
# (Deliver exactly once). Defaults to 0.
#<broker>.qos=<qos>
# Optional. True or false. Defines if the broker should retain the messages sent to
# it. Defaults to false.
<broker>.retain=true
# Optional. True or false. Defines if messages are published asynchronously or
# synchronously. Defaults to true.
<broker>.async=false
# Optional. Defines the last will and testament that is sent when this client goes offline
# Format: topic:message:qos:retained <br/>
#<broker>.lwt=<last will definition>