Aller au contenu

sebcbien

Membres confirmés
  • Compteur de contenus

    4 189
  • Inscription

  • Dernière visite

  • Jours gagnés

    85

Tout ce qui a été posté par sebcbien

  1. ok, donc avec ces modif, ca fonctionne :-) Par contre j'ai une petite demande: J'avais créé des boutons style AllOn AllOff jusque là pas de souci Mais j'avais créé aussi des boutons In Only et Out Only qui eux activaient les camera 1 et 2 et désactivaient les cameras 3 4 et 5. Donc voilà , si tu ne sais pas comment t'occuper, c'est une idée d'amélioration ;-) Sinon le retour d'état est vraiment sympa et ça va beaucoup plus vite qu'avant...
  2. pour start et stop, je dois mettre ceci pour que ça fonctionne: (version=1) function Action() for i = 1, #cameras do if action == "start" or action == "stop" then payload = "/webapi/"..pathRecord.."?api=SYNO.SurveillanceStation.ExternalRecording&method=Record&version=1&cameraId="..cameras[i].."&action="..action.."&_sid="..SID
  3. après avoir créé les variables globales àla main et effacé les fonction de check et création du main loop, ça va déjàmieux, enable et disable fonctionnent avec ce code ci: -------------------------------------------------- -- Module : Synology Surveillance Station v4 -- Button : Start/Stop recording -- Author : Lazer -------------------------------------------------- -- User configurable variables --[[login = "" password = "" cameras = {0} action = "start" ]]-- local login = "" local password = "" local cameras = {1,2,4,5,6} local action = "Enable" -- start/stop/Enable/Disable -- System variables local debug_trace = false error = false local selfID = fibaro:getSelfId() local ip = fibaro:get(selfID, 'IPAddress') local port = fibaro:get(selfID, 'TCPPort') local Synology = Net.FHttp(ip, tonumber(port)) local API_COMMON_ERROR_CODE = { [100] = "Unknown error", [101] = "Invalid parameters", [102] = "API does not exist", [103] = "Method does not exist", [104] = "This API version is not supported", [105] = "Insufficient user privilege", [106] = "Connection time out", [107] = "Multiple login detected" } local API_AUTH_ERROR_CODE = { [100] = "Unknown error.", [101] = "The account parameter is not specified.", [400] = "Invalid password.", [401] = "Guest or disabled account.", [402] = "Permission denied.", [403] = "One time password not specified.", [404] = "One time password authenticate failed." } local API_RECORD_ERROR_CODE = { [400] = "Execution failed.", [401] = "Parameter invalid.", [402] = "Camera disabled." } -- Message function function Message(log_msg, label_msg, trace, debug_msg) if log_msg then fibaro:log(log_msg) end if debug_msg and (debug_trace or trace) then fibaro:debug(debug_msg) end if label_msg then fibaro:call(selfID, "setProperty", "ui.LabelStatus.value", label_msg) fibaro:setGlobal('SurvStation_Status', label_msg) end end -- Get Cameras list local camera = false if cameras then for k, v in ipairs(cameras) do if v > 0 then Message(nil, nil, false, "cameras{} exists") camera = true break end end end if not camera then local label = fibaro:get(selfID, "ui.LabelCameras.value") if label ~= nil and label ~= "" then Message(nil, nil, false, "Create cameras{}") cameras = json.decode(label) end end Message(nil, nil, false, "cameras{} : " .. json.encode(cameras)) -- génération d'un nouvel SID function GetSID() -- Create new login session fibaro:debug("Request new SID") payload = "/webapi/"..pathAuth.."?api=SYNO.API.Auth&method=Login&version=2&account="..login.."&passwd="..password.."&session=SurveillanceStation&format=sid" Message(nil, nil, false, payload) response, status, errorCode = Synology:GET(payload) if tonumber(errorCode) == 0 and tonumber(status) == 200 then if response ~= nil and response ~= "" then jsonTable = json.decode(response) if jsonTable.success == true then fibaro:setGlobal('SurvStation_SID', jsonTable.data.sid) Message(nil, nil, true, "Synology API Auth OK") else fibaro:debug('<span style="color:red;">Error : API Authentication failure, '..(API_AUTH_ERROR_CODE[tonumber(jsonTable.error.code)] or API_COMMON_ERROR_CODE[tonumber(jsonTable.error.code)] or "???")..'</span>') end else fibaro:debug('<span style="color:red;">Error : API Authentication failure, empty response</span>') end else fibaro:debug('<span style="color:red;">Error : API Authentication failure, errorCode='..errorCode..', status='..status..'</span>') end end -- Destroy current login session function Destroy() -- fibaro:debug("Destroy current SID") payload = "/webapi/"..pathAuth.."?api=SYNO.API.Auth&method=Logout&version=2&session=SurveillanceStation&_sid="..SID response, status, errorCode = Synology:GET(payload) end -- Start or stop external recording of a camera function Action() for i = 1, #cameras do if action == "start" or action == "stop" then payload = "/webapi/"..pathRecord.."?api=SYNO.SurveillanceStation.ExternalRecording&method=Record&version=2&cameraId="..cameras[i].."&action="..action.."&_sid="..SID else payload = "/webapi/"..pathCamera.."?api=SYNO.SurveillanceStation.Camera&method="..action.."&version=3&cameraIds="..cameras[i].."&_sid="..SID end Message(nil, nil, false, payload) response, status, errorCode = Synology:GET(payload) if tonumber(errorCode) == 0 and tonumber(status) == 200 then if response ~= nil and response ~= "" then jsonTable = json.decode(response); if jsonTable.success == true then if action == "start" or action == "stop" then Message("OK", action.." OK", true, '<span style="color:green;">Synology Surveillance Station '..action..' recording for camera "'..tostring(cameras[i])..'" OK</span>') else Message("OK", action.." OK", true, '<span style="color:green;">Synology Surveillance Station '..action..' camera "'..tostring(cameras[i])..'" OK</span>') end else if action == "start" or action == "stop" then Message("Erreur", action.." failed", true, '<span style="color:red;">Synology Surveillance Station '..action..' recording for camera "'..tostring(cameras[i])..'" FAILED : '..(API_RECORD_ERROR_CODE[tonumber(jsonTable.error.code)] or API_COMMON_ERROR_CODE[tonumber(jsonTable.error.code)] or "???")..', '..response..'</span>') else Message("Erreur", action.." failed", true, '<span style="color:red;">Synology Surveillance Station '..action..' camera "'..tostring(cameras[i])..'" FAILED : '..(API_CAMERA_ERROR_CODE[tonumber(jsonTable.error.code)] or API_COMMON_ERROR_CODE[tonumber(jsonTable.error.code)] or "???")..', '..response..'</span>') end if tonumber(jsonTable.error.code) == 105 then error = true end end else if action == "start" or action == "stop" then Message("Erreur", action.." failed", true, '<span style="color:red;">Synology Surveillance Station '..action..' recording for camera failed, empty response</span>') else Message("Erreur", action.." failed", true, '<span style="color:red;">Synology Surveillance Station '..action..' camera failed, empty response</span>') end end else if action == "start" or action == "stop" then Message("Erreur", action.." failed", true, '<span style="color:red;">Synology Surveillance Station '..action..' recording for camera failed, errorCode='..errorCode..', status='..status..', response='..(response or "")..'</span>') else Message("Erreur", action.." failed", true, '<span style="color:red;">Synology Surveillance Station '..action..' camera failed, errorCode='..errorCode..', status='..status..', response='..(response or "")..'</span>') end end end end -- Discover available APIs and corresponding information if action == "start" or action == "stop" or action == "Enable" or action == "Disable" then -- only if a valid action fibaro:call(selfID, "setProperty", "ui.LabelStatus.value", action.."...") payload = "/webapi/query.cgi?api=SYNO.API.Info&method=Query&version=1&query=SYNO.API.Auth,SYNO.SurveillanceStation.ExternalRecording,SYNO.SurveillanceStation.Camera" Message(nil, nil, false, payload) response, status, errorCode = Synology:GET(payload) if tonumber(errorCode) == 0 and tonumber(status) == 200 then if response ~= nil and response ~= "" then jsonTable = json.decode(response); if jsonTable.data["SYNO.API.Auth"].maxVersion >= 3 and jsonTable.data["SYNO.SurveillanceStation.Camera"].maxVersion >= 2 then Message(nil, nil, true, "Synology API version OK") pathAuth = jsonTable.data["SYNO.API.Auth"].path pathRecord = jsonTable.data["SYNO.SurveillanceStation.ExternalRecording"].path pathCamera = jsonTable.data["SYNO.SurveillanceStation.Camera"].path Message(nil, nil, false, "Synology API Auth path = "..pathAuth) Message(nil, nil, false, "Synology API Surveillance Station Record path = "..pathRecord) Message(nil, nil, false, "Synology API Surveillance Station Camera path = "..pathCamera) SID = fibaro:getGlobal('SurvStation_SID') if SID == nil or SID == "" then Destroy() GetSID() SID = fibaro:getGlobal('SurvStation_SID') end Message(nil, nil, false, "Synology API Auth SID = "..SID) Action() if error == true then Destroy() GetSID() SID = fibaro:getGlobal('SurvStation_SID') Action() end else Message("Erreur", action.." failed", true, '<span style="color:red;">Error : Synology API version is too old : <b>DSM 4.0-2251</b> and <b>Surveillance Station 6.3</b> are required</span>') end else Message("Erreur", action.." failed", true, '<span style="color:red;">Error : Can not connect to Synology server, empty response</span>') end else Message("Erreur", action.." failed", true, '<span style="color:red;">Error : Can not connect to Synology server, errorCode='..errorCode..', status='..status..', ip='..ip..', port='..port..', payload='..payload..', response='..(response or "")..'</span>') end else Message("Erreur", action.." failed", true, '<span style="color:red;">Error : Not a valid action.</span>') end
  4. si a la ligne +- 169 je met ceci: if jsonTable.data["SYNO.API.Auth"].maxVersion >= 3 and jsonTable.data["SYNO.SurveillanceStation.Camera"].maxVersion >= 2 then je n'ai plus le message d'erreur de version mais j'ai ceci: (pour Enable) [DEBUG] 18:22:23: Synology API version OK [DEBUG] 18:22:23: Request new SID [DEBUG] 18:22:24: Synology API Auth OK [ERROR] 18:22:25: line 138: attempt to index global 'API_CAMERA_ERROR_CODE' (a nil value)
  5. salut jojo. Premier retour: [DEBUG] 18:14:56: Error : Synology API version is too old : DSM 4.0-2251 and Surveillance Station 6.3 are required voici le code que j'utilise avec succès jusqu'à présent. Je n'ai pas beacoup de temps pour le moment, j'ai décha chipoté un peu mais sans succès, ça fait longtemps que je ne me suis pas penchcé sur ce code... :-/ -------------------------------------------------- -- Synology Surveillance Station v2 -- Start/Stop recording -- Lazer -- Mars 2014 -------------------------------------------------- -- User configurable variables local login = "" local password = "" local cameras = {1,2,4,5,6} local action = "start" -- System variables local selfID = fibaro:getSelfId() local ip = fibaro:get(selfID, 'IPAddress') local port = fibaro:get(selfID, 'TCPPort') local Synology = Net.FHttp(ip, tonumber(port)) local API_AUTH_ERROR_CODE = { [100] = "Unknown error.", [101] = "The account parameter is not specified.", [400] = "Invalid password.", [401] = "Guest or disabled account.", [402] = "Permission denied.", [403] = "One time password not specified.", [404] = "One time password authenticate failed." } local API_RECORD_ERROR_CODE = { [100] = "Unknown error.", [101] = "Invalid parameters.", [102] = "API does not exist.", [103] = "Method does not exist.", [104] = "This API version is not supported.", [105] = "Insufficient user privilege.", [106] = "Connection time out.", [400] = "Execution failed.", [401] = "Parameter invalid.", [402] = "Camera disabled." } -- Discover available APIs and corresponding information payload = "/webapi/query.cgi?api=SYNO.API.Info&method=Query&version=1&query=SYNO.API.Auth,SYNO.SurveillanceStation.ExternalRecording" response, status, errorCode = Synology:GET(payload) if tonumber(status) == 200 then jsonTable = json.decode(response); if jsonTable.data["SYNO.API.Auth"].maxVersion >= 3 and jsonTable.data["SYNO.SurveillanceStation.ExternalRecording"].maxVersion >= 1 then fibaro:debug("Synology API version OK") pathAuth = jsonTable.data["SYNO.API.Auth"].path pathRecord = jsonTable.data["SYNO.SurveillanceStation.ExternalRecording"].path fibaro:debug("Synology API Auth path = "..pathAuth) fibaro:debug("Synology API Surveillance Station Record path = "..pathRecord) -- Create new login session payload = "/webapi/"..pathAuth.."?api=SYNO.API.Auth&method=Login&version=2&account="..login.."&passwd="..password.."&session=SurveillanceStation&format=sid" response, status, errorCode = Synology:GET(payload) if tonumber(status) == 200 then jsonTable = json.decode(response); if jsonTable.success == true then SID = jsonTable.data.sid fibaro:debug("Synology API Auth SID = "..SID) for i = 1, #cameras do -- Start or stop external recording of a camera payload = "/webapi/"..pathRecord.."?api=SYNO.SurveillanceStation.ExternalRecording&method=Record&version=1&cameraId="..cameras[i].."&action="..action.."&_sid="..SID response, status, errorCode = Synology:GET(payload) jsonTable = json.decode(response); fibaro:debug(response) if jsonTable.success == true then fibaro:log("OK") fibaro:debug('<span style="color:green;">Synology Surveillance Station '..action..' recording for camera "'..tostring(cameras[i])..'" OK</span>') else fibaro:log("Erreur") fibaro:debug('<span style="color:red;">Synology Surveillance Station '..action..' recording for camera "'..tostring(cameras[i])..'" FAILED : '..API_RECORD_ERROR_CODE[tonumber(jsonTable.error.code)]..'</span>') end end -- Destroy current login session payload = "/webapi/"..pathAuth.."?api=SYNO.API.Auth&method=Logout&version=2&session=SurveillanceStation&_sid="..SID response, status, errorCode = Synology:GET(payload) else fibaro:log("Erreur") fibaro:debug('<span style="color:red;">Error : '..API_AUTH_ERROR_CODE[tonumber(jsonTable.error.code)]..'</span>') end else fibaro:log("Erreur") fibaro:debug('<span style="color:red;">Error : API Authentication failure</span>') end else fibaro:log("Erreur") fibaro:debug('<span style="color:red;">Error : Synology API version is too old : <b>DSM 4.0-2251</b> and <b>Surveillance Station 6.1</b> are required</span>') end else fibaro:log("Erreur") fibaro:debug('<span style="color:red;">Error : Can not connect to Synology server</span>') end dans le mainloop aussi problème: [ERROR] 18:09:54: line 261: Expected value but found T_END at character 1 une idée ?
  6. Ce n'est pas une tare en soi de programmer via le clavier il prendra un peu plus de temps c'est tout. Ensuite tu pourra télécharger la configuration via dloadx. N'oublie pas de lui demander les codes admin et installateur. Normalement avec le code admin tu peux changer le code installateur. Sent from my SM-N910F using Tapatalk
  7. Salut Toutmonde :-) Bon, j'ai cliqué pour passer de ma V3.6 en V4, mais j'ai eu une erreur 10. Je vais contacter le support fibaro pour demander un nettoyage. A part ça, rien de spécial àprévoir pour le passage àla V4 ? J'ai passé toutes mes scènes et VD en revue et utilisé les id de l'id générator. A par reboot, clear cache, y a t'il autre chose àprévoir ? Avant il y avait beaucoup de remarques dans les fils de migration, mais maintenant je ne vois plus grand chose... a part value et power changé pour les consomations, d'autre modifs dans les scripts ? Merci :-)
  8. sebcbien

    Support Gea

    De ce que j'ai vaguement compris c la température de la plaque du billard, pas d'une pièce. Sent from my SM-N910F using Tapatalk
  9. sebcbien

    Support Gea

    Je pensais la même chose, ce n'est pas le genre de problème pour GEA. Le plus simple est peut être aussi de convertir la scène bloc en LUA et la peaufiner. Sent from my SM-N910F using Tapatalk
  10. sebcbien

    Support Gea

    Bonjour gorn, Je te conseille de jeter un coup d'œil au showroom gea (dans ma signature), il y a plein de cas d'allumage auto documentés Tu devras utiliser un -1 juste après la partie déclenchement. Mais aussi un restart task. Sent from my SM-N910F using Tapatalk
  11. De hcl vers hc2 ? Sent from my SM-N910F using Tapatalk
  12. Coupons ? Sent from my SM-N910F using Tapatalk
  13. Qu'est-ce qu'ils appellent conversion ?!? 3.6 vers 4.x ? Sent from my SM-N910F using Tapatalk
  14. Surtout que maintenant il est stable, testé et approuvé par @jojo, excusez de la référence ;-) Sent from my SM-N910F using Tapatalk
  15. Son c'est micro et haut parleur ou seulement micro ? Et il faut en raccorder un externe ? Sent from my SM-N910F using Tapatalk
  16. J'ai eu une fausse alerte il y a un mois. Je ne voyais rien sur les cameras, mais il n'y en a pas partout dans la maison... Pouvoir écouter la maison permet d'avoir plus d'informations. Sent from my SM-N910F using Tapatalk
  17. Tu utilises yaps comme simulation ?Sent from my SM-N910F using Tapatalk
  18. Sympa celle d'intérieur !! Manque que le son :-/ Sent from my SM-N910F using Tapatalk
  19. la logique actuelle c'est que lorsqu'il est occupé a faire la simulation, s'il est interrompu, il analyse la raison de l'interruption (endtime ou simupresence=0) et déclenche deux procédure d'arrêt différents. ensuite si c'est simupresence=0 alors la scène est arrêtée, sinon il entre dans une boucle de calcul et d'attente du prochain sunset. dans cette boucle (la "while true do" tout a la fin), si simupresence passe a 0 alors il abort aussi. seulement ce test ne se fait que toutes les minutes pour ne pas charger la box. comme tu vois l'architecture ne se prête pas trop a ce besoin et j'irais plutot chez Steven pour ca :-)
  20. attention aussi aux camera dome + leds IR... Cedric L en avait testé et disait que les leds se réfléchissent sur le dome et "éblouissent" la caméra ce qui donne un halo baveux la nuit... j'imagine qu'avec une bonne conception il y a moyen d'y remédier.
  21. pfouuu... je vois le truc d'ici, id de vd, id bouton on, id bouton off, ca change vraiment beaucoup de choses :-/ Si je fais une V4 j'y penserai mais la pour le moment j'ai déjà plein de trucs pour mes neurones ;-)
  22. pour moi c'est normal, la simulation s'est arrêtée entre 0h15 et 0h21 puis elle a attendu le prochain sunset. et à 1h10 vous êtes rentrés, la simulation ne tournais pas, donc pas d'arrêt de simulation, donc pas de lampe allumée. je ferais une ligne gea style if entre 00h15 et sunrise et AT_home then lampe_rez_hall on
  23. Attention aux hautes résolutions style 4mpix... Il faut avoir une bonne connexion pour pouvoir uploader de la maison vers votre mobile... Ou alors avoir 3 flux, un pour enregistrer en HD sur un synology, un pour streamer vers mobile (àpartir du syno ou de la camera) en résolution dégradée et un mjpeg pour la hc2. Mais ça commence àfaire du boulot pour la caméra...Sent from my SM-N910F using Tapatalk
  24. Merci àtous pour vos suggestions. Pour faire un petit retour de mon expérience de caméras, pour le moment j'ai des huacam bullet infrarouges en extérieur. Elles sont bi-flux mjpeg - h.264. J'en suis assez content mais elles ne sont plus vendues. La portée de l'infrarouge est pas mal, c'est plus qu'un gadget. Le poe est vraiment pratique. Un inconvénient des ces super low cost c'est souvent le cpu/serveur web. Ici si elles sont trop sollicitées.. Elles rebootent... Donc pour moi et la raison de ce fil c'est d'en trouver une similaire mais stable et avec une meilleure résolution. Question angle il faut bien réfléchir aussi, pour mon utilisation je cherche un angle de +-90° et donc une haute résolution car la surface couverte sera plus grand qu'avec un angle de 60°.... Pas facile Sent from my SM-N910F using Tapatalk
  25. De mémoire, oui... Sent from my SM-N910F using Tapatalk
×
×
  • Créer...