I have a problem with a rule, which is to control a lamp by a voice control. The voice control gives out a JSON array, so I added a log output to my rule to see if all parameters are given right. All of it is correct, but inside the “Then” part, it should control the lamp wtih the read-out parameters, but there is no action inside my log for the lamp.
so here is the rule:
rule “VIC”
when
Item LivingRoom_Sprachsteuerung received update
then
logInfo("Sprachsteuerung steuert Gerät: ", LivingRoom_Sprachsteuerung_intent.state.toString)
var Number intentValue = transform(“JSONPATH”, “$.content.slots.[0].value”, LivingRoom_Sprachsteuerung_dimmer.state.toString)
var String pureIntent = transform(“JSONPATH”, “$.content.intent”, LivingRoom_Sprachsteuerung_intent.state.toString)
var String device_val = transform(“JSONPATH”, “$.content.slots.[0].name”, LivingRoom_Sprachsteuerung_name.state.toString)
logInfo("Welcher Wert: ", device_val)
logInfo("Wert: ", intentValue)
logInfo("Snips device value: ", pureIntent)
if (pureIntent = “lampe”) {
sendCommand(LivingRoom_Ecklampe_Color, intentValue)
} else if (pureIntent = “stehlampe”) {
LivingRoom_Stehlampe_Color = sendCommand(intentValue)
}
if (device_val = “helligkeit”) {
sendCommand(LivingRoom_Ecklampe_Dimmer, intentValue)
}
end
and the only thing inside my Log Viewer is this, but no control happens:
Maybe someone can help me, what is wrong in here.