Originally posted by rge
View Post
Announcement
Collapse
No announcement yet.
TRÅDFRI Button
Collapse
X
-
Hi!
I bougth 2 TRADFRI shortcut button and added it easily with JowiHue and Conbee II. Detected as a switch and a battery.
I've created events that toggle the table lamp near the bed of the kids. They can switch on and off the lamp plugged in a z-wave smart outlet. It work great!
I'm able to get 3 types of status with the button :- Short press : On short (1001)
- Hold long press : On holding (1002)
- Long press released : On released long (1003)
I configured two events :- Event1 (Turn the lamp ON) : If device had its value set to « On short » and the lamp is OFF, Set the lamp to ON.
- Event2 (Turn the lamp OFF) : If device had its value set to « On short » and the lamp is ON, Set the lamp to OFF.
A lot of possibility, for 9.99$ in Canada, cant find anything cheaper!
- Likes 1
Comment
-
Originally posted by flaplante99 View PostHi!
I bougth 2 TRADFRI shortcut button and added it easily with JowiHue and Conbee II. Detected as a switch and a battery.
I've created events that toggle the table lamp near the bed of the kids. They can switch on and off the lamp plugged in a z-wave smart outlet. It work great!
I'm able to get 3 types of status with the button :- Short press : On short (1001)
- Hold long press : On holding (1002)
- Long press released : On released long (1003)
I configured two events :- Event1 (Turn the lamp ON) : If device had its value set to « On short » and the lamp is OFF, Set the lamp to ON.
- Event2 (Turn the lamp OFF) : If device had its value set to « On short » and the lamp is ON, Set the lamp to OFF.
A lot of possibility, for 9.99$ in Canada, cant find anything cheaper!
I just put a new battery in and will wait and see how long it lasts.
- Likes 1
Comment
-
Oops. I made two mistakes here.
1. I didnt see that the post is a year old
2. I'm still figuring out how to quote someone.
I'm still interested in an answer though.
I've been wrestling with how to do a toggle function for some time now. I normally use two events but its kind of kludgey.
This is what I was replying to.
Originally posted by AshaiRey View Post
You can use a virtual device to toggle it's state.
Or create a timer that starts running at the 1e press and counts the number of presses in say 2 seconds. An event then triggers based on the number of key presses detected and registered in the counter.
I use just one button to turn my alarm on or off (double presses) or turn the lights off when there is just one press detected.
Comment
-
Originally posted by dmagerl View PostOops. I made two mistakes here.
1. I didnt see that the post is a year old
2. I'm still figuring out how to quote someone.
I'm still interested in an answer though.
I've been wrestling with how to do a toggle function for some time now. I normally use two events but its kind of kludgey.
This is what I was replying to.
if device is set or changed
And if device is short press
and light is off
turn on
then do the same but
and light is on
turn off
Comment
-
Originally posted by mik3 View Post
Just build it based off conditions.
if device is set or changed
And if device is short press
and light is off
turn on
then do the same but
and light is on
turn off
When I ran HS3 I used a script command to do toggling:
Code:&sdvRef = hs.GetDeviceRefByName("device name here") : if hs.ison(dvRef) then hs.CAPIControlHandler(hs.CAPIGetSingleControl(dvRef, True, "off", False, True)) Else hs.CAPIControlHandler(hs.CAPIGetSingleControl(dvRef, True, "on", False, True)) end if
In HS4 it seems to get triggered twice, the second time it errors out. It still works though.
In HS4pi its seems to error out immediately and never runs.
Since I'm now running HS4pi, I guess I'll keep doing what I'm doing now with the two events for each device needing to toggle.
Comment
-
Originally posted by dmagerl View PostOops. I made two mistakes here.
1. I didnt see that the post is a year old
2. I'm still figuring out how to quote someone.
I'm still interested in an answer though.
I've been wrestling with how to do a toggle function for some time now. I normally use two events but its kind of kludgey.
This is what I was replying to.
Comment
-
I found a workaround for the buttons not having an actual button status in Homeseer.
- buy a dummy device to create scenes on (the cheapest bulb)
- for each button, create a scene that controls the dummy device, call them something like B1press, B1double, B1long, B2press, B2double etc
- now you can trigger off the value of the Mood device :-)
One extra thing is needed - pressing the same button twice doesn't update anything, so I created another scene called "Bnull" which I reset the mood back to using a script triggered off the change:
Code:Private Const devMood as Integer = 1082 ' put the device ID of your mood device in here Sub Main(parms As Object) Dim mood as String = hs.CAPIGetStatus(devMood).Status() If Left(mood, 1) = "B" AndAlso Val(Mid(mood, 2, 1)) > 0 Then hs.WriteLog("Ikea, "Mood set to button " & mood) hs.WaitSecs(0.25) CallCAPI(devMood, "Bnull") End If End Sub Function CallCAPI(ByVal intDevRef As Integer, ByVal strDevCmd As String) As CAPIControlResponse CallCAPI = CAPIControlResponse.Indeterminate For Each objCAPIControl As CAPIControl In hs.CAPIGetControl(intDevRef) If LCase(objCAPIControl.Label) = LCase(strDevCmd) Then CallCAPI = hs.CAPIControlHandler(objCAPIControl) Exit Function End If Next End Function
- Likes 1
Comment
-
Originally posted by rge View Post
One extra thing is needed - pressing the same button twice doesn't update anything, so I created another scene called "Bnull" which I reset the mood back to using a script triggered off the change:
Comment
Comment