- Platform information:
- Hardware: Raspberry PI3+
- OS: openHABian
- Java Runtime Environment: javac 1.8.0_222
- openHAB version: 2.4.0-1
- Issue of the topic:
I want to interface openhab and Arduino, equipped with an 8-relay board and a temperature sensor, using the MQTT protocol. I installed MQTT Binding and enbedded MQTT Broker, on Openhab.
Arduino subscribes to the following topics:
-for sensors:
> controller_garage/sensor/humidity
> controller_garage/sensor/temperature
-for commands (payload “on” and “off”)
> “controller_garage/switch1”
> “controller_garage/switch2”
> “controller_garage/switch3”
> “controller_garage/switch4”
> “controller_garage/switch5”
> “controller_garage/switch6”
> “controller_garage/switch7”
> “controller_garage/switch8”
-for states (payload “on” and “off”)
> “controller_garage/switchconfirm1”
> “controller_garage/switchconfirm2”
> “controller_garage/switchconfirm3”
> “controller_garage/switchconfirm4”
> “controller_garage/switchconfirm5”
> “controller_garage/switchconfirm6”
> “controller_garage/switchconfirm7”
> “controller_garage/switchconfirm8”
The broker works well. Taking of evidence by “mqtt.fx”, relays respond to commands and update status.
I manually configured openhab and I can not update the relay states.
The temperature and humidity sensors work perfectly with OpenHab but the relay, no.
This is my configuration:
.things
//MQTT Binding
Bridge mqtt:systemBroker:embedded-mqtt-broker "MQTT Broker" @ "Garage" [ host="localhost", secure=false ] {
Thing topic mqtt_things "MQTT Things" @ "Garage" {
Channels:
Type number : temperature "Air Temperature" [ stateTopic="controller_garage/sensor/temperature"]
Type number : humidity "Humidity" [stateTopic="controller_garage/sensor/humidity"]
Type switch : switch1 "switch1" [stateTopic="controller_garage/switchconfirm1", commandTopic="controller_garage/switch1", on="on", off="off"]
}
}
.items
//MQTT
Number Temperature "Garage Temperature[%.2f °C]" <temperature> ["TargetTemperature"] { channel = "mqtt:topic:embedded-mqtt-broker:mqtt_things:temperature" }
Number Humidity "Garage Humidity[%.2f %%]" <humidity> { channel = "mqtt:topic:embedded-mqtt-broker:mqtt_things:humidity" }
Switch mqttsw1 "mqttsw1" <light> [ "Lighting" ] {channel = "mqtt:topic:embedded-mqtt-broker:switch1:command", channel = "mqtt:topic:embedded-mqtt-broker:switch1:state" }
.sitemap
Frame label="test" {
Text item=Temperature
Text item=Humidity
Switch item=mqttsw1
}
When active mqttsw1 (from Basic UI) I have the following message in the logs without any effect on relay1.
Can you help me?
Thank you