Hello, i am new in this communty and i have a problem with my first rule.
i found a rule for my project but a have follow error:
i hope anywhere can help me
[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Toggle Tuya light/switch on/off via MQTT’: An error occurred during the script execution: index=0, size=0
Rule:
rule “Licht/switch on/off via MQTT”
when
Item Wohnwand received command
then
switch(receivedCommand) {
case ON : actions.publishMQTT(“tuya/socket/02200490dc4f2215bd31/xxxxxxxxxxxx/192.168.1.147/command/on”,"")
case OFF : actions.publishMQTT(“tuya/socket/02200490dc4f2215bd31/xxxxxxxxxxxx/192.168.1.147/command/off”,"")
}
end
rule “Licht/switch on/off via MQTT”
when
Item Wohnwand received command
then
switch(receivedCommand) {
case ON : actions.publishMQTT(“tuya/socket/02200490dc4f2215bd31/xxxxxxxxxxxx/192.168.1.147/command/on”,"")
case OFF : actions.publishMQTT(“tuya/socket/02200490dc4f2215bd31/xxxxxxxxxxxx/192.168.1.147/command/off”,"")
}
Why don’t you use the binding directly?
Create a Generic MQTT thing
Add a switch channel
Command topic = tuya/socket/02200490dc4f2215bd31/xxxxxxxxxxxx/192.168.1.147/command
And an outgoing value transformation with a map file: MAP:ONonOFFoff.map