Aller au contenu

971jmd

Membres confirmés
  • Compteur de contenus

    3 525
  • Inscription

  • Dernière visite

  • Jours gagnés

    10

Tout ce qui a été posté par 971jmd

  1. 971jmd

    SIRI et HC3

    Salut à tous Avez-vous des new concernant l'interopérabilité de SIRI et la HC3 ?
  2. Salut à oui c’est plus simple c’est quoi function QuickApp:onInit() end
  3. 971jmd

    Conditions/Triggers

    toujours erreur quand je place uniquement : local VALEUR = tonumber(fibaro(id,"value")) j'ai 07.10.2020] [16:42:46] [ERROR] [SCENE74]: (load):4: attempt to call a table value (global 'fibaro')
  4. 971jmd

    Conditions/Triggers

    Salut, si je comprends bien la fonction récupérer à la ID du module qui est en appel Et la stock temporairement dans la variable local
  5. 971jmd

    getSourceTrigger

    est-il possible de lire également un Minimote de chez AEON LABS local sa = tonumber(json.encode(sourceTrigger.value)) ---BOUTON 1 et 2 if (sa == 1) then fibaro.call(91, 'toggle') end ----bouton 1 if (sa == 2) then fibaro.call(89, 'toggle') end ----bouton 2 etc
  6. 971jmd

    getSourceTrigger

    j'ai un autre problème, comment évitée qu'un TRIGGER d'déclenche tout un scene J'ai 2 module 110 et 112 (volet roulant) dans ma scène j'ai plusieurs actions En gros si un appelle arrive du 110 active uniquement le code correspondant Pour le moment si 110 ou 112 s'active j'ai tout la scène qui s'exécute.
  7. 971jmd

    getSourceTrigger

    J'ai fini par trouver, merci pour vos conseilles ----DÉCLARATIONS (Conditions/Déclencheurs) { conditions = { { id = 87, isTrigger = true, operator = "anyValue", property = "sceneActivationEvent", type = "device", } }, operator = "any" } -------ACTION ----local ButtonPressed = fibaro:getValue(87, "sceneActivationEvent") local sa = tonumber(json.encode(sourceTrigger.value)) ---BOUTON 1 et 2 if (sa == 1) then fibaro.call(91, 'toggle') end if (sa == 2) then fibaro.call(89, 'toggle') end ---BOUTON 3 et 4 if (sa == 3) then fibaro.call(98, 'open') end if (sa == 3) then fibaro.call(95, 'open') end if (sa == 4) then fibaro.call(98, 'close') end if (sa == 4) then fibaro.call(95, 'close') end ---BOUTON 7 et 8 ---if (sa == 7) then fibaro.call(98, 'close') end if (sa == 8) then fibaro.profile(4, 'activateProfile') end
  8. 971jmd

    Conditions/Triggers

    salut merci pour ton aide Avec la ligne : j'ai une erreur [06.10.2020] [16:10:36] [ERROR] [SCENE74]: (load):1: Assertion failed: Expected number
  9. salut à tous Je n'ai pas encore le déclic concernant QA j'ai lu la doc : https://manuals.fibaro.com/home-center-3-quick-apps/ mais je comprends pas Comment faire un QA simple avec deux boutons ON et OFF pour allumer un device j'ai testé ça mai rein off = function() fibaro.call(155, "turnOff") end on = function() fibaro.call(155, "turnOn") end function QuickApp:buttonoff(param) fibaro.HomeCenter.SystemService.off() end function QuickApp:button2(param) fibaro.HomeCenter.SystemService.on() end function QuickApp:onInit() end merci d'avance
  10. 971jmd

    Welcome HC3

    salut je cherche à crée un QA pour activée : Protection locale et Protection à distance J'ai testé le code dans une scène et j'arrive à activée et désactivé ---- 2 = ON ---- 0 = OFF local deviceID=95 local json = api.get("/devices/" ..deviceID) json.properties.localProtectionState = 0 api.put("/devices/" ..deviceID, json) ---- 1 = ON ---- 0 = OFF local deviceID2 = 95 local json = api.get("/devices/"..deviceID2) json.properties.RFProtectionState = 1 api.put("/devices/"..deviceID2, json) l'idée est créée un QA avec deux boutons Protection locale et Protection à distance mai je n'ai pas encor compris comment fonctionne le QA de la HC3
  11. bon là c'est bien la 1ère fois que je ne comprends rien
  12. 971jmd

    Conditions/Triggers

    salut à tous j'ai une scène avec 2 device (volet roulant) pensez-vous qu'il est possible que quand j'actionne un seul volet le 98 par exemple que je ne recois pas de réaction du le 95 { operator = "any", conditions = { { type = "device", id = 95, property = "value", operator = "anyValue", value = false, isTrigger = true }, { type = "device", id = 98, property = "value", operator = "anyValue", value = false, isTrigger = true } } } local id = 95 local variable = "telegram" --- nom de la variable local idlampe = fibaro.getName(id) --- nom du device local valeur = fibaro.get(id, "value")-- récupérartion de la valeur du device fibaro.setGlobalVariable(variable, tostring(idlampe .. " est à " .. valeur) .. " pourcent") local id = 98 local variable = "telegram" --- nom de la variable local idlampe = fibaro.getName(id) --- nom du device local valeur = fibaro.get(id, "value")-- récupérartion de la valeur du device fibaro.sleep(3000) fibaro.setGlobalVariable(variable, tostring(idlampe .. " est à " .. valeur) .. " pourcent")
  13. 971jmd

    LUA HC3

    c'est comme ça qu'on apprend ça fonctionne fibaro.setGlobalVariable("telegram", tostring(idlampe .. " est à " .. valeur) .. " P100") Merci j'ai appris une choses: concaténer
  14. 971jmd

    LUA HC3

    j'ai testé ça aussi pour essayer de placer un mot devant la valeur et reçois que lampe j'ai tester avec ou sans les () toujour rien fibaro.setGlobalVariable("telegram", ("..lampe.."), tostring(valeur) .. " P100")
  15. 971jmd

    LUA HC3

    fibaro.setGlobalVariable('telegram', tostring(valeur) .. "%%") non plus et si je teste avec : fibaro.setGlobalVariable('telegram', tostring(valeur) .. "la HC3 %") non plus
  16. 971jmd

    LUA HC3

    Merci pour l'info sinon .."%" ne fonctionne pas, si je ne trompe pas % permet de comblée des espaces un truc comme ça fonctionne fibaro.setGlobalVariable('telegram', tostring(valeur).."pourcentage") Ne fonctionne pas fibaro.setGlobalVariable('telegram', tostring(valeur).."%")
  17. 971jmd

    LUA HC3

    et si je souhait ajouter un texte après valeur Pour le moment je recrois un chiffre comme par exemple 27 et je souhaiterais 27 % fibaro.setGlobalVariable('telegram', tostring(valeur))
  18. 971jmd

    LUA HC3

    Merci ça fonctionne télégramme fonctionne sur ma HC3 C'est quoi la fonctionne de tostring en 2 mots je cherche désespérément à prendre des cours sur les bases du LUA FIBARO
  19. 971jmd

    LUA HC3

    salut j'ai refait ma variable local valeur = fibaro.get(107, "value") print("message telegram = " .. valeur) fibaro.setGlobalVariable('telegram', valeur) et toujours la même erreur [05.10.2020] [13:39:14] [DEBUG] [SCENE74]: message telegram = 44 [05.10.2020] [13:39:14] [ERROR] [SCENE74]: (load):3: Assertion failed: Expected string
  20. 971jmd

    Telegram Messenger et HC2 FIBARO

    Salut Topic sur la HC3
  21. 971jmd

    Telegram HC3

    Telegram HC3 Sur Quick APP de de la HC3 origine : https://forum.fibaro.com/topic/52109-lua-telegram-change-hc2-to-hc3-where-am-i-going-wrong/ ---change ton BOT KEY local BOT_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--== function QuickApp:onInit() self:debug("onInit") end function dump(o) if type(o) == 'table' then local s = '{ ' for k,v in pairs(o) do if type(k) ~= 'number' then k = '"'..k..'"' end s = s .. '['..k..'] = ' .. dump(v) .. ',' end return s .. '} ' else return tostring(o) end end function QuickApp:sendPhoto(fileName, image, chat_id) function base64dec(data) local b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" -- You will need this for encoding/decoding data = string.gsub(data, "[^" .. b .. "=]", "") return (data:gsub( ".", function(x) if (x == "=") then return "" end local r, f = "", (b:find(x) - 1) for i = 6, 1, -1 do r = r .. (f % 2 ^ i - f % 2 ^ (i - 1) > 0 and "1" or "0") end return r end ):gsub( "%d%d%d?%d?%d?%d?%d?%d?", function(x) if (#x ~= 8) then return "" end local c = 0 for i = 1, 8 do c = c + (x:sub(i, i) == "1" and 2 ^ (8 - i) or 0) end return string.char(c) end )) end function getFileExtension(fileName) return fileName:match("^.+(%..+)$") end if tonumber(chat_id) == nil then self:error("chat_id is null or empty!") return end if not fileName or fileName and fileName == "" then self:error("fileName of picture is null or empty!") return end if not image or image and image == "" then self:error("image message is null or empty!") return end local img = base64dec(image) local file_ext = getFileExtension(fileName) if string.lower(file_ext) == ".png" then file_ext = "png" else -- as JPG file_ext = "jpeg" end -- image/jpeg .jpg, .jpeg, .jfif, .pjpeg, .pjp -- image/png .png print("Sending photo to ", chat_id) local headers = { ["Accept"] = "application/json", ["Cache-Control"] = "no-cache" } headers["Content-Type"] = "multipart/form-data; boundary=----WebKitFormBoundaryX3bY6PBMcxB1vCan" local bodyhead = "" bodyhead = bodyhead .. '------WebKitFormBoundaryX3bY6PBMcxB1vCan' bodyhead = bodyhead .. '\r\n' bodyhead = bodyhead .. "Content-Disposition: form-data; name=\"chat_id\"" .. "\r\n" .. "\r\n" bodyhead = bodyhead .. chat_id bodyhead = bodyhead .. '\r\n' bodyhead = bodyhead .. '------WebKitFormBoundaryX3bY6PBMcxB1vCan' bodyhead = bodyhead .. '\r\n' bodyhead = bodyhead .. [[Content-Disposition: form-data; name="photo"; filename=fileName]] bodyhead = bodyhead .. '\r\n' bodyhead = bodyhead .. 'Content-Type: image/'..file_ext bodyhead = bodyhead .. '\r\n' bodyhead = bodyhead .. '\r\n' bodyhead = bodyhead .. img bodyhead = bodyhead .. '\r\n' bodyhead = bodyhead .. '------WebKitFormBoundaryX3bY6PBMcxB1vCan--' local body = bodyhead local url = "https://api.telegram.org/bot".. BOT_KEY .."/sendPhoto" local http = net.HTTPClient() http:request( url, { options = { method = "POST", headers = headers, data = body }, success = function(response) if (response.status >= 200) then if func then func(json.decode(response.data)) else print(response.data) end else self:error("Wrong status '" .. response.status .. "' in response!") end end, error = function(message) self:error("Connection error: " .. message) end } ) end function QuickApp:sendMessage(text, chat_id) if tonumber(chat_id) == nil then self:error("chat_id is null or empty!") return end if not text or text and text == "" then self:error("text message is null or empty!") return end local body = {chat_id = chat_id, text = text} local headers = { ["Accept"] = "application/json", ["Content-Type"] = 'application/json', ["Cache-Control"] = "no-cache" } local url = "https://api.telegram.org/bot" .. BOT_KEY .. "/sendMessage" local http = net.HTTPClient() http:request( url, { options = { method = "POST", headers = headers, data = json.encode(body) }, success = function(response) if (response.status >= 200) then if func then func(json.decode(response.data)) else print(response.data) end else self:error("Wrong status '" .. response.status .. "' in response!") end end, error = function(message) self:error("Connection error: " .. message) end } ) end dans une scéne local id = 150 -- Id du Quick APP local chat_id = 1111111 ---chat ID de votre telegram local msg = "coucou" print("message telegram = " .. msg) fibaro.call(id, "sendMessage", msg , chat_id)
  22. 971jmd

    LUA HC3

    Salut a tout Ne sachant pas ou trouvée un topic sur le code LUA sur la HC3 je cherche à attribuer la valeur d'un module dans une variable Le print me revois bien la valeur de mon FGD-212 mais rien dans ma variable local valeur = (fibaro.get(107, "value")) print("message telegram = " .. valeur) fibaro.setGlobalVariable('telegrame', valeur) merci d'avance pour votre aide
  23. Merci ça fonctionne ou pourrais-je trouver un tuto ou notice... sur quick-app en français ? tostring est une facon deconvertire la valeur en nombre ?
  24. salut j'essaye de d'ajouter la valeur d'un slider dans la variable mode et j'arrive pas function QuickApp:onSliderChanged(event) local value = event.values[1] self:debug("valeur est>>> ", value) fibaro.setGlobalVariable("mode", value) end merci pour votre aide
  25. oui,quand j'appuis sur 1 j'ai 1 -2 j'ai 2.....
×
×
  • Créer...