Author Topic: Minimote and GE Remote 45600 lua code  (Read 182 times)

Offline lakewoodjazz

  • Sr. Newbie
  • *
  • Posts: 34
  • Karma: +1/-0
Minimote and GE Remote 45600 lua code
« on: February 16, 2018, 01:35:29 pm »
First I want to thank all the posters for helping me put together alot of fun and useful Home Automation scenes and of course "pairing the devicies". I've learned since the X10 days HA requires patience and persisitence.

Recently members Akbooer & ListerD helped me get these lua codes working on my Vera Edge UI7. I found many topics but they really helped me with implementing the codes I found by searching through posts.
Also was able to put multiple device codes into the "Also, execute the following Luup code" part of creating a scene. This enables me to toggle or brighten/dim multiple lamps and recessed lights in a room with one button!

To Toggle the buttons.
GE 45600 Remote: buttons 1-9 only work but this code allows you to toggle the light off & on. Offering two actions for the one button. (18 potential actions on this remote) :)
Minimote: enales you to toggle on/off with either a short press or a long press. Offers potentially 8  actions on tis remote. :)

TOGGLE DEVICE ON/OFF
CHANGE 24 TO YOUR dID#

luup.call_action ("urn:micasaverde-com:serviceId:HaDevice1", "ToggleState", {}, 24)


To BRIGHTEN BY 10 PERCENT each press of a button:

CHANGE 99 TO YOUR dID#
local dID = 99
local curlev = tonumber((luup.variable_get("urn:upnp-org:serviceId:Dimming1","LoadLevelStatus",99)))
local newlev = curlev + 10
if newlev > 100 then newlev = 100 end
if newlev ~= curlev then
     luup.call_action("urn:upnp-org:serviceId:Dimming1","SetLoadLevelTarget",{newLoadlevelTarget=newlev},99)
end


To FADE BY 10 PERCENT:

CHANGE 99 TO YOUR dID#
local dID = 99
local curlev = tonumber((luup.variable_get("urn:upnp-org:serviceId:Dimming1","LoadLevelStatus",dID)))
local newlev = curlev - 10
if newlev < 0 then newlev = 0 end
if newlev ~= curlev then
     luup.call_action("urn:upnp-org:serviceId:Dimming1","SetLoadLevelTarget",{newLoadlevelTarget=newlev},dID)
end

AJbooer cleaned up the dimming/brightening code abit.

local dID = 413
local sID = "urn:upnp-org:serviceId:Dimming1"
local curlev = tonumber((luup.variable_get(sID,"LoadLevelStatus", dID)))
local newlev = math.max (curlev - 10, 0)
if newlev ~= curlev then
     luup.call_action(sID,"SetLoadLevelTarget",{newLoadlevelTarget=newlev}, dID)
end

It sure is satisfying when the Home Automation Gods are working with us!