Aller au contenu

Rechercher dans la communauté

Affichage des résultats pour les étiquettes 'qnap'.



Plus d’options de recherche

  • Rechercher par étiquettes

    Saisir les étiquettes en les séparant par une virgule.
  • Rechercher par auteur

Type du contenu


Forums

  • Bienvenue
    • Nouveau ? Présentez-vous
    • Le bistrot
    • Mon installation domotique
    • Annonces et suggestions
  • La Home Center et ses périphériques
    • La Home Center pour les nuls
    • HC 2 & Lite
    • HC 3
    • Modules Fibaro
    • Modules Z-wave
    • Périphériques et matériels autres
    • Plugins
    • Quick App
    • Multimédia (audio, vidéo ...)
    • Chauffage et Energie
    • Actionneurs & Ouvrants (Portail, volets, piscines, ...)
    • Eclairage
    • Applications Smartphones et Tablettes
  • Autres solutions domotiques
    • Box / Logiciel
    • Modules Nice (433 & 866 MHz)
    • Modules Zigbee
    • GCE Electronics
    • Modules Bluetooth Low Energy
  • Objets connectés
    • Les Assistants Vocaux
    • Netatmo
    • Philips Hue
    • DIY (Do It Yoursel)
  • Sécurité
    • Alarmes
    • Caméras
    • Portiers
    • Serrures
  • Informatique / Réseau
    • Tutoriels
    • Matériels Réseaux
    • Matériels Informatique
    • NAS
    • Virtualisation
  • Les bonnes affaires
    • Sites internet
    • Petites annonces

Calendriers

Aucun résultat à afficher.


Rechercher les résultats dans…

Rechercher les résultats qui…


Date de création

  • Début

    Fin


Dernière mise à jour

  • Début

    Fin


Filtrer par nombre de…

Inscription

  • Début

    Fin


Groupe


Jabber


Skype


Ville :


Intéret :


Version

2 résultats trouvés

  1. manufilm

    éteindre qnap

    bonne chance à tout le monde, j'ai lu loin et loin le post mais je ne peux pas comprendre comment créer ou mieux quel code insère dans le VD pour éteindre le qnap. Je ne suis pas bon avec le LUA mais j'aimerais le faire. Pouvez-vous m'aider?
  2. labomatik

    Pilotez Votre Qnap Avec La Hc2

    Bonjour à tous, Voici un petit tutoriel sur comment piloter son nas QNAP avec la HC2. Je ne suis pas dévelopeur LUA sous HC2 donc il y a surement moyen d'optimiser tout ça (notamment les variables login/pass). Les 3 exemples sont basés sur mes besoins actuels, j'arrête mon nas le soir avec l'armement de mon alarme et rallume avec le désarmement de mon alarme grace au WOL (plugin fibaro). Avec les nouvelles génération de nas X51, il est possible de lancer la commande sleep et non shutdown, ce qui permet au NAS d'être réveillé en 5 secondes (RAM sauvegardée) Configuration QNAP Vous devez autoriser la connexion sans SSL (la HC2 ne supporte pas le ssl) HC2 voici un exemple de quelques fonctions que j'ai utilisé pour commander mon NAS - arrêter le nas proprement - démarrer l'enregistrement des caméras de la station de surveillance - arrêter l'enregistrement des caméras de la station de surveillance si vous voulez obtenir l'API complet des fonctions des NAS qnap, envoyez un petit mail à developer@qnap.com (anglais) --> Je ne suis pas dévelopeur et/ou je ne veux pas comprendre Voici alors le virtuel device déjà prêt avec les 3 fonctions vous devez configurer l'IP et le port dans la configuration du virtuel device et adapter le login/pass dans le code des 3 boutons (remplacez LOGIN_NAS et PASSWORD_NAS) QNAP.vfib.zip --> Je suis dévelopeur et/ou je veux comprendre démarrer l'enregistrement: local ip_module = fibaro:get(fibaro:getSelfId(), "IPAddress") local port = fibaro:get(fibaro:getSelfId(), "TCPPort") surveillance_Station = Net.FHttp(ip_module, port) surveillance_Station:setBasicAuthentication("LOGIN_NAS", "PASSWORD_NAS") response = surveillance_Station:GET("/cgi-bin/mrec.cgi?ch=1&act=1") if (string.find(response, "OK")) then fibaro:log("Starting Recording") else fibaro:log("ERROR") end arrêter l'enregistrement local ip_module = fibaro:get(fibaro:getSelfId(), "IPAddress") local port = fibaro:get(fibaro:getSelfId(), "TCPPort") surveillance_Station = Net.FHttp(ip_module, port) surveillance_Station:setBasicAuthentication("LOGIN_NAS", "PASSWORD_NAS") response = surveillance_Station:GET("/cgi-bin/mrec.cgi?ch=1&act=0") if (string.find(response, "OK")) then fibaro:log("Stop Recording") else fibaro:log("ERROR") end la partie plus complexe qui nécessite un parseur XML, l'arret du NAS if (not QNAP) then QNAP = {} QNAP.qnap_ip = fibaro:get(fibaro:getSelfId(), "IPAddress"); QNAP.port = fibaro:get(fibaro:getSelfId(), "TCPPort"); QNAP.globalvariable = "" -- -------------------------------------------------------------------------------------------------------------- -- Obtient le XML et le retourne sous forme de table LUA -- -------------------------------------------------------------------------------------------------------------- QNAP.getTokenFromXml = function() local QNAP2URL = Net.FHttp(QNAP.qnap_ip,QNAP.port); response = QNAP2URL:GET("/cgi-bin/authLogin.cgi?user=LOGIN_NAS&plain_pwd=PASSWORD_NAS&remme=1"); xmlTable = QNAP.iif(response ~= nil, QNAP.newParser().ParseXmlText(response), ""); if (xmlTable.QDocRoot ~= nil) then qsidstr = xmlTable.QDocRoot.authSid:value(); if (string.len(qsidstr)>0) then fibaro:debug("Qtoken founded"); qsidstr = qsidstr:gsub("[".."<![CDATA[".."]", ''); qsidstr = qsidstr:gsub("[".."]".."]", ''); qsidstr = qsidstr:gsub("["..">".."]", ''); fibaro:debug(qsidstr); response = QNAP2URL:GET("/cgi-bin/sys/sysRequest.cgi?subfunc=power_mgmt&count=0.1234&sid="..qsidstr.."&apply=shutdown"); if (string.find(response, "OK")) then fibaro:log("Power Off Server") else fibaro:log("ERROR") end end end end -- ------------------------------------------------------------------------------------------------------------- -- Teste la condition et retourne la valeur true ou false -- ------------------------------------------------------------------------------------------------------------- QNAP.iif = function(condition, iftrue, iffalse) if (condition) then return iftrue end return iffalse end -- ------------------------------------------------------------------------------------------------------------- -- Ceci est une version modifiée par Steven de Corona-XML-Module par Jonathan Beebe qui a son tour -- est basée sur Alexander Makeev's Lua-only XML parser . -- see https://github.com/Cluain/Lua-Simple-XML-Parser -- ------------------------------------------------------------------------------------------------------------- QNAP.newParser = function() parseXml = {} parseXml.FromXmlString = function(value) value = string.gsub(value, "([%x]+)%;", function(h) return string.char(tonumber(h, 16)) end); value = string.gsub(value, "([0-9]+)%;", function(h) return string.char(tonumber(h, 10)) end); value = string.gsub(value, "'", "'"); value = string.gsub(value, ">", ">"); value = string.gsub(value, "<", "<"); value = string.gsub(value, "&", "&"); return value; end parseXml.ParseArgs = function(node, s) string.gsub(s, "(%w+)=([\"'])(.-)%2", function(w, _, a) node:addProperty(w, parseXml.FromXmlString(a)) end) end parseXml.ParseXmlText = function(xmlText) local stack = {} local top = parseXml.newNode() table.insert(stack, top) local ni, c, label, xarg, empty local i, j = 1, 1 while true do ni, j, c, label, xarg, empty = string.find(xmlText, "<(%/?)([%w_:]+)(.-)(%/?)>", i) if not ni then break end local text = string.sub(xmlText, i, ni - 1); if not string.find(text, "^%s*$") then local lVal = (top:value() or "") .. parseXml.FromXmlString(text) stack[#stack]:setValue(lVal) end if empty == "/" then -- empty element tag local lNode = parseXml.newNode(label) parseXml.ParseArgs(lNode, xarg) top:addChild(lNode) elseif c == "" then -- start tag local lNode = parseXml.newNode(label) parseXml.ParseArgs(lNode, xarg) table.insert(stack, lNode) top = lNode else -- end tag local toclose = table.remove(stack) -- remove top top = stack[#stack] if #stack < 1 then error("XmlParser: nothing to close with " .. label) end if toclose:name() ~= label then error("XmlParser: trying to close " .. toclose.name .. " with " .. label) end top:addChild(toclose) end i = j + 1 end local text = string.sub(xmlText, i); if #stack > 1 then error("XmlParser: unclosed " .. stack[#stack]:name()) end return top end parseXml.newNode = function(name) local node = {} node.___value = nil node.___name = name node.___children = {} node.___props = {} function node:value() return self.___value end function node:setValue(val) self.___value = val end function node:name() return self.___name end function node:setName(name) self.___name = name end function node:children() return self.___children end function node:numChildren() return #self.___children end function node:addChild(child) if self[child:name()] ~= nil then if type(self[child:name()].name) == "function" then local tempTable = {} table.insert(tempTable, self[child:name()]) self[child:name()] = tempTable end table.insert(self[child:name()], child) else self[child:name()] = child end table.insert(self.___children, child) end function node:properties() return self.___props end function node:numProperties() return #self.___props end function node:addProperty(name, value) local lName = "@" .. name if self[lName] ~= nil then if type(self[lName]) == "string" then local tempTable = {} table.insert(tempTable, self[lName]) self[lName] = tempTable end table.insert(self[lName], value) else self[lName] = value end table.insert(self.___props, { name = name, value = self[name] }) end return node end return parseXml; end end QNAP.getTokenFromXml();
×