Can you help me out creating a routine with Tuya and Hue

Hi all, I connected to Apilio customer care, who suggested to drop my question here :slight_smile: I am a noob regarding these things: I cannot manage tocreate a routine in Apilio that does the trick for me.

I would love to program button 2 via Apilio, with this objective:

  • When pressing button 2 once, Hue lights go on
  • When pressing button 2 twice, Hue lights go off

Is it possible to share a condition with me? Or to tell me step by step what to do? Thx!

Dennis

Hi @dennisdevogt ,

I have two ideas:

  1. Can you get the status of the light (or the socket, if you use one) via the Tuya app? Because then you could build a toggle button (and you don’t use a double press)
  2. Does the switch itself distinguish single and double presses? (if you can apply different logic to the buttons in the Tuya app, then it probably does).

Hi there, thanks for thinking along. Please read below.

1. Can you get the status of the light (or the socket, if you use one) via the Tuya app? Because then you could build a toggle button (and you don’t use a double press)

No I can’t. The Smart Life app doesn’t support Philips Hue smart lights last I 've heared. I don’t use a smart socket. After some searching I find out people who want to control their Hue lights via Smart Life, they use Apilio.

2. Does the switch itself distinguish single and double presses? (if you can apply different logic to the buttons in the Tuya app, then it probably does).

It does!

Condition should be something like this:

I don’t have any switch that detects double press, so I don’t know what to expect in “Status” and “Must be” fields

Make sure “Use as trigger” is checked, so the logicblock where you include this condition is triggered when the condition goes TRUE

@dennisdevogt You probably can connect the Philips Hue bulbs with the Tuya Zigbee hub (at least basic functionality works, I have tested that once). But I guess you want to keep the Hue ecosystem, so this path is not a good option.

If you open the device from the devices list (https://app.apilio.com/devices), which device attributes do you see?

When I use this link I see all my Hue lights and all my Tuya switches. What I need to know is how to make a routine. How do I set this up in this Apilio system?

Hi @dennisdevogt,
we first need to learn a bit how those switches work. Once that’s clear, building the automation is probably no problem.
So next, open the detail screen of your device, click on “Edit” and then move all toggles for device attributes to “Monitor in Apilio”.

After saving it, you can use the switch and see what data arrives in Apilio.
E.g. do a single click, reload the device page and take a note of the value that was registered. Then do the same for a double click.

Can you post here the screenshots?

I assume that you want a single click to toggle the lights on or off, so you need to keep track of the current status of the light. If that is the case, you can use Apilio variables to hold the on/off status and so act on that every time the button is pressed.

To do this, for each individual switch. create a boolean variable “switch_x_status” (for a 4 switch box you can make 4 versions)

Use a Tuya condition “switch_x_pressed” for the switch that triggers on single press

Create a logicblock “do_switch_x_pressed” that is executed when the tuya condition switch_x_pressed changes
For the action, use a webhook to update your switch_x_status by toggling the value

Create a boolean condition “is_switch_x_TRUE” that tests whether switch_x_status is TRUE

Create a logicblock “turn_on_off_light_x” that triggers depending on is_switch_x_TRUE
For the action on TRUE, switch on your light
For the action on FALSE, switch off your light