SimonT Posté(e) le 29 janvier 2016 Signaler Partager Posté(e) le 29 janvier 2016 Bonjour, J'aimerai savoir si il est possible sur un bouton virtuel codé en LUA de le faire fonctionner en fonction de plage horaire Exemple: Entre 5H et 16H59 il lance la request HTTP 1 Entre 17H et 4H59 il lance la request HTTP 2 Merci Lien vers le commentaire Partager sur d’autres sites More sharing options...
mprinfo Posté(e) le 29 janvier 2016 Signaler Partager Posté(e) le 29 janvier 2016 Oui c'est possible Envoyé de mon SM-G900F en utilisant Tapatalk 1 Lien vers le commentaire Partager sur d’autres sites More sharing options...
SimonT Posté(e) le 29 janvier 2016 Auteur Signaler Partager Posté(e) le 29 janvier 2016 J'avais regardé ici http://www.fibarouk.co.uk/support/lua/library/ mais je vois pas trop comment faire Si quelqu'un pouvait me donner un exemple de code avec 2 ou 3 plage horaire merci Lien vers le commentaire Partager sur d’autres sites More sharing options...
pepite Posté(e) le 29 janvier 2016 Signaler Partager Posté(e) le 29 janvier 2016 Salut, Comme ceci local currentDate = os.date("*t") if ((string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) >= "05:00") and (string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) <= "16:59")) then requete HTTP1 elseif requete HTTP2 end Lien vers le commentaire Partager sur d’autres sites More sharing options...
SimonT Posté(e) le 29 janvier 2016 Auteur Signaler Partager Posté(e) le 29 janvier 2016 Merci beaucoup je fais mes tests dès que je rentre Lien vers le commentaire Partager sur d’autres sites More sharing options...
SimonT Posté(e) le 30 janvier 2016 Auteur Signaler Partager Posté(e) le 30 janvier 2016 si je fais exactement ce bouton mais ca ne marche pas local currentDate = os.date("*t") if ((string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) >= "04:00") and (string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) <= "9:00")) then HC2 = Net.FHttp("192.168.1.xx", yyyy); HC2:GET("/api/rest/speech/tts?text=Toutes%20vos%20configurations%20du%20matin%20sont%20activ%C3%A9") elseif HC2 = Net.FHttp("192.168.1.xx", yyyy); HC2:GET("/api/rest/speech/tts?text=Toutes%20vos%20configurations%20sont%20activ%C3%A9") end J'ai cette erreur dans le debug [ERROR] 08:13:32: line 7:'then' expected near '=' Lien vers le commentaire Partager sur d’autres sites More sharing options...
SimonT Posté(e) le 30 janvier 2016 Auteur Signaler Partager Posté(e) le 30 janvier 2016 ca ne marche pas Lien vers le commentaire Partager sur d’autres sites More sharing options...
SimonT Posté(e) le 1 février 2016 Auteur Signaler Partager Posté(e) le 1 février 2016 Bonjour Qui pourrait m'aider le elseif ne marche pas qui serait comment faire sur le code que j'ai écri merci Lien vers le commentaire Partager sur d’autres sites More sharing options...
Domodial Posté(e) le 1 février 2016 Signaler Partager Posté(e) le 1 février 2016 Je pense qu'il manque un bout de quelque chose. A mon avis une instance d'authentification. Mais je ne suis pas expert... HC2 = Net.FHttp("192.168.1.xx") HC2:setBasicAuthentication("admin","admin") Quoi que non finalement je ne pense pas que ce soit ça... Pour un bouton VD qui lance du tts...ça m'étonne... Attends un expert qui passera par là c'est mieux Lien vers le commentaire Partager sur d’autres sites More sharing options...
SimonT Posté(e) le 1 février 2016 Auteur Signaler Partager Posté(e) le 1 février 2016 meme en m'inspirant de ca http://www.lua.org/pil/4.3.1.html ca ne marche pas cela prend que la première request http local currentDate = os.date("*t") if ((string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) >= "04:00") and (string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) <= "5:00")) then HC2 = Net.FHttp("192.168.1.xx", yyyy); HC2:GET("/api/rest/speech/tts?text=Alarme%20d%C3%A9sActiv%C3%A9%20%20%20bienvenue%20chez%20moi") elseif ((string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) >= "16:00") and (string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) <= "18:00")) then HC2 = Net.FHttp("192.168.1.xx", yyyy); HC2:GET("/api/rest/speech/tts?text=Alarme%20d%C3%A9sActiv%C3%A9%20%20%20bienvenue%20chez%20toi") else HC2 = Net.FHttp("192.168.1.xx", yyyy); HC2:GET("/api/rest/speech/tts?text=Alarme%20d%C3%A9sActiv%C3%A9%20%20%20bienvenue%20chez%20fukers") end Lien vers le commentaire Partager sur d’autres sites More sharing options...
Messages recommandés