I am building a video doorbell which has a small OLED screen on it. There is a ESP8266 12E in the doorbell that is handling the doorbell press and running the OLED. I have several sensors around the house all using MQTT, but this is the first to have an OLED with a message on it. Also, I’m running OH1.
The code that is running on the doorbell is subscribed to homey\frontdoorbell\message, which works great when I use MQTT fx app to publish the message manually, such as the word “Hello”.
My question is, how do I, in openhab, publish a message string? For testing, I have a rule that triggers off the button being pressed and I want that rulle to change the message on the OLED to “Hello”. I have a second rule that will do the same kind of function when the button isn’t being pressed.
Here’s my current sitemap:
Text item=FrontDoorBellTemp label=“Front Door Temperature [%.0fF]” icon=“temperature”
{
Text item=FrontDoorBellTemp
Text item=FrontDoorBellPressure
Text item=FrontDoorBellHumidity
Switch item=FrontDoorBellRestart mappings=[ON=“Restart”]
Switch item=FrontDoorBellButton mappings=[ON=“Pressed”,OFF=“UnPressed”]
Setpoint item=FrontDoorBellTempCal label=“Temperature Calibration [%.0fF]” minValue=-10.0 maxValue=10.0 step=1
Text item=FrontDoorBellDefaultMessage label=“msg [%s]”
Text item=FrontDoorBellButtonMessage
}
items:
Number FrontDoorBellTemp “Air Temperature [%.1fF]” (temperature) //{mqtt="<[pimqtt:homey/2ndfloor/tempbaro/temp:state:default]"}
Number FrontDoorBellPressure “Barometric Pressure[%.0fPa]” (pressure) {mqtt="<[pimqtt:homey/frontdoorbell/tempbaro/pressure:state:default]"}
Number FrontDoorBellHumidity “Humidity [%.0f%%]” (humidity) {mqtt="<[pimqtt:homey/frontdoorbell/tempbaro/hum:state:default]"}
Switch FrontDoorBellRestart “Restart” (test) {mqtt=">[pimqtt:homey/frontdoorbell/settings/cmd:command:*:default]"}
Switch FrontDoorBellButton “Button” {mqtt=">[pimqtt:homey/frontdoorbell/button/state:default]"}
String FrontDoorBellDefaultMessage “Default Message” {mqtt=">[pimqtt:homey/frontdoorbell/defaultmessage/state:default]"}
String FrontDoorBellButtonMessage “Button Press Message” {mqtt=">[pimqtt:homey/frontdoorbell/buttonmessage/state:default]"}
rule:
rule “FrontDoorBellPressMessage”
when
Item FrontDoorBellButton changed from OFF to ON
then
postUpdate(FrontDoorBellButtonMessage,"Test")
end
Thanks for your help in advance!