-
Compteur de contenus
215 -
Inscription
-
Dernière visite
-
Jours gagnés
45
Tout ce qui a été posté par jang
-
QuickApp - Chauffage Fil Pilote Qubino
jang a répondu à un(e) sujet de fredokl dans Quick App Developpeur
http://www.lua.org/manual/5.3/manual.html#3.4.1 "With the exception of exponentiation and float division, the arithmetic operators work as follows: If both operands are integers, the operation is performed over integers and the result is an integer. Otherwise, if both operands are numbers or strings that can be converted to numbers (see §3.4.3), then they are converted to floats, the operation is performed following the usual rules for floating-point arithmetic (usually the IEEE 754 standard), and the result is a float. Exponentiation and float division (/) always convert their operands to floats and the result is always a float. Exponentiation uses the ISO C function pow, so that it works for non-integer exponents too." -
It works very well for me. Does it show up in the block scene editor? The "Central Scene ID" option? Remote.fqa
-
This QA shows up in the block scene editor for me function QuickApp:onInit () self:debug ("Remote") local inf = api.get("/devices/"..self.id).interfaces for _,i in ipairs(inf) do if i=='zwaveCentralScene' then inf=nil; break end end if inf then inf[#inf+1]='zwaveCentralScene' self:addInterfaces(inf) end self:debug(json.encode(inf)) self: updateProperty ( "centralSceneSupport" , { {keyAttributes = { "Pressed" , "Released" , "HeldDown" , "Pressed2" , "Pressed3" }, keyId = 1 }, {keyAttributes = { "Pressed" , "Released" , "HeldDown" , "Pressed2" , "Pressed3" }, keyId = 2 }, {keyAttributes = { "Pressed" , "Released" , "HeldDown" , "Pressed2" , "Pressed3" }, keyId = 3 }, {keyAttributes = { "Pressed" , "Released" , "HeldDown" , "Pressed2" , "Pressed3" }, keyId = 4 }, {keyAttributes = { "Pressed" , "Released" , "HeldDown" , "Pressed2" , "Pressed3" }, keyId = 5 }, {keyAttributes = { "Pressed" , "Released" , "HeldDown" , "Pressed2" , "Pressed3" }, keyId = 6 }, {keyAttributes = { "Pressed" , "Released" , "HeldDown" , "Pressed2" , "Pressed3" }, keyId = 7 }, {keyAttributes = { "Pressed" , "Released" , "HeldDown" , "Pressed2" , "Pressed3" }, keyId = 8 }, {keyAttributes = { "Pressed" , "Released" , "HeldDown" , "Pressed2" , "Pressed3" }, keyId = 9 }, {keyAttributes = { "Pressed" , "Released" , "HeldDown" , "Pressed2" , "Pressed3" }, keyId = 10 }, {keyAttributes = { "Pressed" , "Released" , "HeldDown" , "Pressed2" , "Pressed3" }, keyId = 11 }, {keyAttributes = { "Pressed" , "Released" , "HeldDown" , "Pressed2" , "Pressed3" }, keyId = 12 }, }) end
-
Have you set interfaces = { 'zwaveCentralScene' } ?
-
function dumpScene(id) local s,c,f = api.get("/scenes/"..id) c = json.decode(s.content) f = io.open("Scene_"..id.."_actions.lua","w"); f:write(c.actions); f:close() f = io.open("Scene_"..id.."_conditions.lua","w"); f:write(c.conditions); f:close() f = io.open("Scene_"..id..".lua","w"); f:write(json.encode(s)); f:close() end --- Download scene from HC3 dumpScene(13) --- Edit Scene_13_actions.lua ... --- Edit Scene_13_conditions.lua ... function restoreScene(id) local f,a,c,s f = io.open("Scene_"..id.."_actions.lua","r"); a=f:read("*all"); f:close() f = io.open("Scene_"..id.."_conditions.lua","r"); c=f:read("*all"); f:close() f = io.open("Scene_"..id..".lua","r"); s=f:read("*all"); f:close() s = json.decode(s) s.content=json.encode({conditions=c,actions=a}) api.put("/scenes/"..id,s) end --- ... then restore scene to HC3 restoreScene(13)
-
Fair enough. I stand corrected, removeChildDevice() is called when children are deleted in the IU, so the onAction hook will work. You could also intercept calls to the method. function QuickApp:onInit() local orgRemoveChildDevice = self.removeChildDevice function self:removeChildDevice(id) self:debug("Child ",id," is about to be deleted") -- do other stuff orgRemoveChildDevice(self,id) end end
-
Quick App - Gestionnaire d'Événements Automatique - GEA pour HC3
jang a répondu à un(e) sujet de Lazer dans Quick App Developpeur
Ok, I understand. Good luck :-) -
Quick App - Gestionnaire d'Événements Automatique - GEA pour HC3
jang a répondu à un(e) sujet de Lazer dans Quick App Developpeur
Is it a GEA syntax problem or api? If it's the api this is what I use in ER4 -- id to profile name function self:profileName(id) for _,p in ipairs(api.get("/profiles").profiles) do if p.id == id then return p.name end end end -- profile name to id function self:profileId(name) for _,p in ipairs(api.get("/profiles").profiles) do if p.name == name then return p.id end end end -- set active profile if id ~= nil, or return current active profile if id == nil function self:activeProfile(id) if id then if type(id)=='string' then id = self:profileName(id) end assert(id,"activeProfile(id) - no such id/name") return api.put("/profiles",{activeProfile=id}) and id end return api.get("/profiles").activeProfile end -
When a child is deleted (from Lua or UI) you get a 'DeviceRemovedEvent' in / refreshStates The QuickApp will also update the self.childDevices table. Why don't you store your extra info in the child table? self.childDevices [childID] .extraInfo = ... it's just the child instance I don't think r emoveChildDevice (...) is called by the QA if you delete the child in the UI.
-
It should work. Be careful if chidId doesn't exist (just removed). HC3 logs a warning if ID doesn't exists. What are you doing with 'removeChildDevice' ?
-
télécharger QA depuis une application tierce
jang a répondu à un(e) sujet de jjacques68 dans Support
Yes, I can. ...but I have a Mac -
télécharger QA depuis une application tierce
jang a répondu à un(e) sujet de jjacques68 dans Support
... and then we want a restore functionality It should be possible to define a github hook to push production branches directly to the HC3. -
télécharger QA depuis une application tierce
jang a répondu à un(e) sujet de jjacques68 dans Support
I use ZeroBrane studio for all my HC3 development with an emulator that simulates the HC3 environment -much easier and productive to code that way... Depends on programming language - you need to create a file and write the content to that file. Lua: local fqa = api.get ("/ quickApp / export /" .. deviceID) local f = io.open (fileName, "w +") assert (f, "Can't open file" ..fileName) f: write (fqa) f: close () -
télécharger QA depuis une application tierce
jang a répondu à un(e) sujet de jjacques68 dans Support
It returns the QA encoded as a .fqa - json forma (including all subfiles) From the HC3/emulator I do api.get("/quickApp/export/"..deviceID) to download QAs... -
Everything I (currently) know about QuickAppChildren ... https://forum.fibaro.com/topic/49113-hc3-quickapps-coding-tips-and-tricks/?do=findComment&comment=223530
-
function QuickApp:test(x) self.x = x; self:debug("self.x is set to ",x) end is identical to function QuickApp.test(self,x) self.x = x; self:debug("self.x is set to ",x) end 'self' is inserted as the first variable of the function, before x when declared with ':' calling self:test(7) is identical to calling self.test(self,7) ...so when you call Object:test(7) it is the same as Object.test(Object,7) so 'self' will be bound to Object When you call Child:Func1() 'self' will be bound to Child, because the call is identical to Child.Func1(Child) It means that inside Func1 we have access to 'self', the object that called Func1 It's syntactic sugar for Lua...
-
Shared code/modules are an interesting topic. It would be nice if the community could agree about a "module" format that made it easy to use each other's modules without polluting the Lua global namespace too much... https://forum.fibaro.com/topic/49113-hc3-quickapps-coding-tips-and-tricks/?do=findComment&comment=223070
-
function QuickApp:getHC3IPaddress(name) if self.IPaddress then return self.IPaddress else name = name or ".*" local networkdata = api.get("/proxy?url=http://localhost:11112/api/settings/network") for n,d in pairs(networkdata.networkConfig or {}) do if n:match(name) and d.enabled then self.IPaddress = d.ipConfig.ip; return self.IPaddress end end end end
-
Quick App - Gestionnaire d'Événements Automatique - GEA pour HC3
jang a répondu à un(e) sujet de Lazer dans Quick App Developpeur
Running GEA 7.01 offline - easier to debug -
plugin.restart()
-
sceneActivationEvent ? https://forum.fibaro.com/topic/49410-hc3-lua-sceneactivation/?do=findComment&comment=216519
-
Isn't that a sceneActivation device? - not a centralSceneEvent device...
-
variable type table API - Erreur - mise à jour propriété de type table
jang a répondu à un(e) sujet de jjacques68 dans Support
...but from another QA you have a table... It's the marshalling of arguments that is broken - try this function QuickApp:test(arg) self:debug("Argument ",tostring(arg)," is a ",type(arg)) end function QuickApp:onInit() fibaro.call(self.id,"test","0042") fibaro.call(self.id,"test","true") fibaro.call(self.id,"test",'{"a":9}') end I complained in February about it... -
self:deleteInterfaces({"light"}) or myQuickApp:deleteInterfaces({"light"})
-
self:createChildDevice always add "quickAppChild" for you. Some types of device will also add their specific interfaces.
