Relay control Rules mqtt

I’m a newbie, please help
I created a rule. I need the rule to do the “sufit” after the command:
1: Assigned the value 877 to the variable “Mowa” (it works)
2: Switch Dioda1 turned the relay on or off (it doesn’t work)

My things

Bridge mqtt:broker:MosquittoMqttBroker “Mój MQTT Broker” [
host=“192.168.10.112”,
secure=false,
port=1883,
clientID=“OpenHAB2”,
username=“abc”,
password=“abc”

My things

Thing mqtt:topic:Dioda1 “Duży pokój” (mqtt:broker:MosquittoMqttBroker) {
Channels:
/* */ Type switch : power “Power Dioda1” [
commandTopic=“cmnd/Plytka186/POWER1”,
stateTopic=“stat/Plytka186/POWER1”,
on=“on”,
off=“off”
] }

My Sitemap

sitemap MojDom label=“Mój Dom”
{
Frame label=“Pokój 1”
{
Switch item=Dioda1 icon=“light”
Switch item=Dioda2 icon=“light”
Switch item=Dioda3 icon=“light”
Switch item=Dioda4 icon=“light”
Text item=StanLED1 icon=“light”
}
/* Switch - przełącznik */
Frame label=“Pokój 2”
{
Text item=Termometr1 label=“Temperatura Duży [%.1f °C]” icon=“temperature” valuecolor=[<20=“orange”,>22=“green”,>23=“red”,<=24=“blue”]
Text item=Wilgotnosc1 label=“Wilgotność Duży [%.1f %%]” icon=“Humidity”
}
Frame label=“Pokój 3”
{
Text item=Ampery icon=“light”
Text item=Odleglosc icon=“incline”
Text item=Mowa
}
}

My items

Switch Dioda1
“Wyłącznik LED1” {channel=“mqtt:topic:Dioda1:power”}

My rules

import java.lang.Object
import org.eclipse.smarthome.core.items.GenericItem
import org.eclipse.smarthome.core.library.items.StringItem

rule “przelacz sufit”
when
Item weather_common_id received command sufit
then
sendCommand(Mowa , 877)
Switch Dioda1 {mqtt=“>[broker:mqtt:topic:Dioda1:power]”}
end

Hello, and welcome!

We’re happy to help, but could you first edit your post and use code fences (three backticks ```) when showing your Things and Items?

```

like this

```

Could you also tell us what version of the MQTT binding you are using? It looks like V2, but your rule send to have a strange v1 configured string…

Which means MQTT binding you are using

Problem solved
Configuration was needed http: // openhabian_id: 8080 / paperui / index.html # / configuration / services? Tab = voice

import java.lang.Object
import org.eclipse.smarthome.core.items.GenericItem
import org.eclipse.smarthome.core.library.items.StringItem

Rules

rule “Sterowanie glosem”

when
Item Sterowanie_glosem received command
then
val txt = receivedCommand.toString.toLowerCase

	if (txt.contains("jasno bok lewa")) 
		Dioda1.sendCommand(ON)
	else if(txt.contains("ciemno bok lewa")) 
		Dioda1.sendCommand(OFF)

end

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.