Rules with TP-Link HS105 Smart Wi-Fi Plug

Hi!

I’m trying to set rules for a HS105 smart wifi plug, I’ve taken the same rules has my Hue lights (who does work ) but with no success, is there a special command for that device?

Here is a snippet of my actual rules:
//Allume les lumieres
rule “Allume les lumières de présence”
when
Item NightState changed to ON
then
sendCommand(Hue_Boule_Toggle, ON)
sendCommand(Hue_Natacha_Toggle, ON)
sendCommand(Hue_Aluminium_Toggle, ON)
sendCommand(PriseFenetreSalon_Switch_Toggle, ON)
end

PriseFenetreSalon_Switch is the HS105 in that rule.

That should work. What is the error that you get? Make sure that you installed the binding, and set up the .things file correctly. I don’t have the HS105, but for the HS100 and HS110, I just use item.sendCommand(ON), which is equivalent to what you use.

Also make sure that the plug is set up correctly; try to control it using the TP app first.

I’m able to control the plug trough the TP app and trough OpenHab but no results with the rules… now I’m not a big pro on using logs… so I should check that but which one and where do I find it?

OK I thing I found the error… here is from a log I found:
2019-01-01 16:21:33.718 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Allume les lumières de présence’: The name ‘PriseFenetreSalon_Switch_Toggle’ cannot be resolved to an item or type; line 39, column 14, length 31

So the item name does not seem to work… let me check…

Hello

Please use the code fences when posting code:
Please use the sendCommand()`method instead of the action in your code
It is the recommend usage. More efficient and other reasons.

//Allume les lumieres
rule “Allume les lumières de présence”
when
    Item NightState changed to ON
then
    Hue_Boule_Toggle.sendCommand(ON)
    Hue_Natacha_Toggle.sendCommand(ON)
    Hue_Aluminium_Toggle.sendCommand(ON)
    PriseFenetreSalon_Switch_Toggle.sendCommand(ON)
end

A better way to do this would be to create a group called GroupLumieresDePresence

Group GroupLumieresDePresence
Switch Hue_Boule_Toggle "xxxxxx" <icon> (GroupLumieresDePresence) { binding }
...

The new rule:

//Allume les lumieres
rule “Allume les lumières de présence”
when
    Item NightState changed to ON
then
    GroupLumieresDePresence.sendCommand(ON)
end