Jump to content
  • 0

Controlling Philips Hue with the Swipe


Question

Hi,

 

Is it possible to control Philips Hue with the Swipe? If so how can I fix this?

 

Marlon

Edited by Kenmar
Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi @Kenmar,

 

I its possible, but you have to create lua scene a use gestures as trigger for a scene.

 

It could be simmilar to folowing scene, that i'm using for NODON, Fib Button and Fib. Keyfob test. But i do not know hot add there gestures UP/DOWN/LEFT/...

--[[
%% properties
%% events
ID_DEVICE CentralSceneEvent 
%% globals
--]]



--*******************************************************************************
--* Notes:                                                                   *
--* tonumber(startSource["keyId"]) = X    ->   X = Button ID                    *
--* tostring(startSource["keyAttribute"]) ->   xyz = action name (Pressed, ...) *
--* ID_Device - Here is Nodn, Fib. Button or Fib. KEyfob ID                     *
--* Tlačítko X stisknuto Yx. - From CZ to Eng - Button X pressed Yx.            *
--* Tlačítko X drženo/puštěno. - From CZ to ENg - Button X Held down/Released.  *
--*******************************************************************************

local startSource = fibaro:getSourceTrigger()["event"]["data"]; -- Button ID load
--fibaro:debug(json.encode(startSource))

-------------- Pro tlačítko 1 ------------------------------------
if tostring(startSource["keyAttribute"]) == "Pressed" and tonumber(startSource["keyId"]) == 1 
then
	fibaro:debug("Tlačítko 1 stisknuto 1x.")
end

if tostring(startSource["keyAttribute"]) == "Pressed2" and tonumber(startSource["keyId"]) == 1 
then
	fibaro:debug("Tlačítko 1 stisknuto 2x.")
end

if tostring(startSource["keyAttribute"]) == "HeldDown" and tonumber(startSource["keyId"]) == 1
then
	fibaro:debug("Tlačítko 1 drženo.")
end

if tostring(startSource["keyAttribute"]) == "Released" and tonumber(startSource["keyId"]) == 1
then
	fibaro:debug("Tlačítko 1 puštěno.")
end

-------------- Pro tlačítko 2 ------------------------------------
if tostring(startSource["keyAttribute"]) == "Pressed" and tonumber(startSource["keyId"]) == 2 
then
	fibaro:debug("Tlačítko 2 stisknuto 1x.")
end

if tostring(startSource["keyAttribute"]) == "Pressed2" and tonumber(startSource["keyId"]) == 2 
then
	fibaro:debug("Tlačítko 2 stisknuto 2x.")
end

if tostring(startSource["keyAttribute"]) == "HeldDown" and tonumber(startSource["keyId"]) == 2
then
	fibaro:debug("Tlačítko 2 drženo.") 
end

if tostring(startSource["keyAttribute"]) == "Released" and tonumber(startSource["keyId"]) == 2 
then
	fibaro:debug("Tlačítko 2 puštěno.")
end

-------------- Pro tlačítko 3 ------------------------------------
if tostring(startSource["keyAttribute"]) == "Pressed" and tonumber(startSource["keyId"]) == 3 
then
	fibaro:debug("Tlačítko 3 stisknuto 1x.")  
end

if tostring(startSource["keyAttribute"]) == "Pressed2" and tonumber(startSource["keyId"]) == 3 
then
	fibaro:debug("Tlačítko 3 stisknuto 2x.")  -- Může být nahrazeno jiným kódem
end

if tostring(startSource["keyAttribute"]) == "HeldDown" and tonumber(startSource["keyId"]) == 3 
then
	fibaro:debug("Tlačítko 3 drženo.")  -- Může být nahrazeno jiným kódem
end

if tostring(startSource["keyAttribute"]) == "Released" and tonumber(startSource["keyId"]) == 3 
then
	fibaro:debug("Tlačítko 3 puštěno.")  -- Může být nahrazeno jiným kódem
end

-------------- Pro tlačítko 4 ------------------------------------
if tostring(startSource["keyAttribute"]) == "Pressed" and tonumber(startSource["keyId"]) == 4 
then
	fibaro:debug("Tlačítko 4 stisknuto 1x.")  -- Může být nahrazeno jiným kódem
end

if tostring(startSource["keyAttribute"]) == "Pressed2" and tonumber(startSource["keyId"]) == 4 
then
	fibaro:debug("Tlačítko 4 stisknuto 2x.")  -- Může být nahrazeno jiným kódem
end

if tostring(startSource["keyAttribute"]) == "HeldDown" and tonumber(startSource["keyId"]) == 4 
then
	fibaro:debug("Tlačítko 4 drženo.")  -- Může být nahrazeno jiným kódem
end

if tostring(startSource["keyAttribute"]) == "Released" and tonumber(startSource["keyId"]) == 4 
then
	fibaro:debug("Tlačítko 4 puštěno.")
end

Best regards,

Jakub

Link to post
Share on other sites
  • 0
3 hours ago, jakub.jezek said:

Hi @Kenmar,

 

I its possible, but you have to create lua scene a use gestures as trigger for a scene.

 

It could be simmilar to folowing scene, that i'm using for NODON, Fib Button and Fib. Keyfob test. But i do not know hot add there gestures UP/DOWN/LEFT/...

--[[
%% properties
%% events
ID_DEVICE CentralSceneEvent 
%% globals
--]]



--*******************************************************************************
--* Notes:                                                                   *
--* tonumber(startSource["keyId"]) = X    ->   X = Button ID                    *
--* tostring(startSource["keyAttribute"]) ->   xyz = action name (Pressed, ...) *
--* ID_Device - Here is Nodn, Fib. Button or Fib. KEyfob ID                     *
--* Tlačítko X stisknuto Yx. - From CZ to Eng - Button X pressed Yx.            *
--* Tlačítko X drženo/puštěno. - From CZ to ENg - Button X Held down/Released.  *
--*******************************************************************************

local startSource = fibaro:getSourceTrigger()["event"]["data"]; -- Button ID load
--fibaro:debug(json.encode(startSource))

-------------- Pro tlačítko 1 ------------------------------------
if tostring(startSource["keyAttribute"]) == "Pressed" and tonumber(startSource["keyId"]) == 1 
then
	fibaro:debug("Tlačítko 1 stisknuto 1x.")
end

if tostring(startSource["keyAttribute"]) == "Pressed2" and tonumber(startSource["keyId"]) == 1 
then
	fibaro:debug("Tlačítko 1 stisknuto 2x.")
end

if tostring(startSource["keyAttribute"]) == "HeldDown" and tonumber(startSource["keyId"]) == 1
then
	fibaro:debug("Tlačítko 1 drženo.")
end

if tostring(startSource["keyAttribute"]) == "Released" and tonumber(startSource["keyId"]) == 1
then
	fibaro:debug("Tlačítko 1 puštěno.")
end

-------------- Pro tlačítko 2 ------------------------------------
if tostring(startSource["keyAttribute"]) == "Pressed" and tonumber(startSource["keyId"]) == 2 
then
	fibaro:debug("Tlačítko 2 stisknuto 1x.")
end

if tostring(startSource["keyAttribute"]) == "Pressed2" and tonumber(startSource["keyId"]) == 2 
then
	fibaro:debug("Tlačítko 2 stisknuto 2x.")
end

if tostring(startSource["keyAttribute"]) == "HeldDown" and tonumber(startSource["keyId"]) == 2
then
	fibaro:debug("Tlačítko 2 drženo.") 
end

if tostring(startSource["keyAttribute"]) == "Released" and tonumber(startSource["keyId"]) == 2 
then
	fibaro:debug("Tlačítko 2 puštěno.")
end

-------------- Pro tlačítko 3 ------------------------------------
if tostring(startSource["keyAttribute"]) == "Pressed" and tonumber(startSource["keyId"]) == 3 
then
	fibaro:debug("Tlačítko 3 stisknuto 1x.")  
end

if tostring(startSource["keyAttribute"]) == "Pressed2" and tonumber(startSource["keyId"]) == 3 
then
	fibaro:debug("Tlačítko 3 stisknuto 2x.")  -- Může být nahrazeno jiným kódem
end

if tostring(startSource["keyAttribute"]) == "HeldDown" and tonumber(startSource["keyId"]) == 3 
then
	fibaro:debug("Tlačítko 3 drženo.")  -- Může být nahrazeno jiným kódem
end

if tostring(startSource["keyAttribute"]) == "Released" and tonumber(startSource["keyId"]) == 3 
then
	fibaro:debug("Tlačítko 3 puštěno.")  -- Může být nahrazeno jiným kódem
end

-------------- Pro tlačítko 4 ------------------------------------
if tostring(startSource["keyAttribute"]) == "Pressed" and tonumber(startSource["keyId"]) == 4 
then
	fibaro:debug("Tlačítko 4 stisknuto 1x.")  -- Může být nahrazeno jiným kódem
end

if tostring(startSource["keyAttribute"]) == "Pressed2" and tonumber(startSource["keyId"]) == 4 
then
	fibaro:debug("Tlačítko 4 stisknuto 2x.")  -- Může být nahrazeno jiným kódem
end

if tostring(startSource["keyAttribute"]) == "HeldDown" and tonumber(startSource["keyId"]) == 4 
then
	fibaro:debug("Tlačítko 4 drženo.")  -- Může být nahrazeno jiným kódem
end

if tostring(startSource["keyAttribute"]) == "Released" and tonumber(startSource["keyId"]) == 4 
then
	fibaro:debug("Tlačítko 4 puštěno.")
end

Best regards,

Jakub

Hi @jakub.jezek,

 

Thanks for the coding. I'm not that familiar yet with LUA coding but give me some time and I will:-) I will play with the code!

 

Regards,

Marlon

Link to post
Share on other sites
  • 0

Hi,

 

i don't have swipe but i see in german forum ( siio.de):

--[[
%% properties
%% events
XXX CentralSceneEvent
%% globals
--]]

local swipe_source = fibaro:getSourceTrigger()["event"]["data"]

-- fibaro:debug("Key " .. swipe_source["keyId"] .. " Attr " .. swipe_source["keyAttribute"])

if (swipe_source["keyId"] == 1) then
 fibaro:debug('up')
elseif (swipe_source["keyId"] == 2) then
 fibaro:debug('down')
elseif (swipe_source["keyId"] == 3) then
 fibaro:debug('left')
elseif (swipe_source["keyId"] == 4) then
 fibaro:debug('right')
end

Maybe you can use it.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...