[LUA] Alarme et notifications

Vous avez créé un script LUA dont vous êtes fier, un .sh génial, un programme Python hors du commun, un Tuto, c'est ici que vous pouvez les partager.
deennoo
Messages : 4036
Inscription : 25 janv. 2015, 02:00

Re: Alarme - Script LUA et notifications

Message par deennoo »

nissart a écrit :j'ai passé mon domoticz sur mon Synology DS213j mais du coup je n'ai plus de GPIO...
trois solutions:
- Repasser le tout sur le RASP
- mettre domoticz en 2eme serveur pour utiliser les GPIO et piloter le tout depuis le syno
- MySensor, puisque j'ai déjà la passerelle d'installée sur le Syno mais ca veut dire nouveau nano, nouveau NRF2401L.... etc
Ou une ampoule Milight si tu as un Rflink.
Ou une ESP8266 avec un ruban de led (ou un H801 avec le FW EASYESP et le plugin Milight).
Ou encore un petit controleur de led en RF (5€ sur ali, compatible rfx et rflink).
Ou une ampoule Yeelight (ampoule WIFI encours d'integration dans Domoticz).
Ou un ZK1PA en 12v avec une ampoule de feu arriere de voiture (rouge)
De quoi se faire Plaisir et essayer d'aider...
http://www.domo-attitude.fr
nissart
Messages : 145
Inscription : 20 avr. 2016, 15:00

Re: Alarme - Script LUA et notifications

Message par nissart »

tu oublies un petit détail:
j'ai un bouton sur mon interphone (ouvrir la porte) qui ne sert à rien.

du coup je vais tirer un cable réseau pour pouvoir jouer avec les GPIO (in et out) ;)
Rpi3 Domoticz v3.9389 - RFX433e - Kira128

Odroid C2/OpenPHT/ Pour le salon
Rpi3/Rasplex/ Pour la chambre

Rpi2/Runeaudio/ Pour le salon + terrasse
Rpi2 hifiberry AMP+/Runeaudio/ pour la sdb

Que j'aime ces petites bestioles !!!
nissart
Messages : 145
Inscription : 20 avr. 2016, 15:00

Re: Alarme - Script LUA et notifications

Message par nissart »

Et voila, un petit cable réseau tiré jusqu'à l'interphone, un rasp en slave, 3 LEDs en gpio out, 1 poussoir en in (celui de l'interphone qui est censé déclencher l'ouverture de la porte) et deux petits scripts supplémentaire qui vont bien.

explication du premier... Si j'appuie sur le bouton poussoir de l'interphone et que l'alarme est désactivée alors on enclenche l'alarme... sinon on la désactive.

Code : Tout sélectionner

commandArray = {}
		if (devicechanged['Interphone'] == 'On') and otherdevices['Alarme'] == 'Off' then 
			print('Alarme Enclenchée')
			commandArray['LEDrouge'] = 'On'
			commandArray['LEDverte'] = 'Off'
			commandArray['Alarme'] = 'On' 
		end
		if (devicechanged['Interphone'] == 'On') and otherdevices['Alarme'] == 'On' then 
			print('Alarme Desactivée')
			commandArray['Alarme'] = 'Off' 
			commandArray['LEDrouge'] = 'Off'
			commandArray['LEDverte'] = 'On'
		end
return commandArray
ce script fonctionne bien si on utilise le bouton poussoir mais ne fonctionne pas depuis la custom page par exemple...
le deuxieme script sert à combler ce manque

Code : Tout sélectionner

commandArray = {}
		if (devicechanged['Alarme'] == 'On')then 
			 print('Alarme Enclenchée')
			commandArray['LEDrouge'] = 'On'
			commandArray['LEDverte'] = 'Off'
			
		end
		if (devicechanged['Alarme'] == 'Off')  then 
			print('Alarme Desactivée')
			commandArray['LEDrouge'] = 'Off'
			commandArray['LEDverte'] = 'On'
		end
return commandArray

je suis en train de rajouter la temporisation mais je bloque un peu... a suivre
Rpi3 Domoticz v3.9389 - RFX433e - Kira128

Odroid C2/OpenPHT/ Pour le salon
Rpi3/Rasplex/ Pour la chambre

Rpi2/Runeaudio/ Pour le salon + terrasse
Rpi2 hifiberry AMP+/Runeaudio/ pour la sdb

Que j'aime ces petites bestioles !!!
deennoo
Messages : 4036
Inscription : 25 janv. 2015, 02:00

Re: Alarme - Script LUA et notifications

Message par deennoo »

Dans mon script.

Pour la tempo de sorti :

Mon inter alarme a un delai d'allumage de 45 secondes.

Pour la tempo d'entree un dummy avec un delai d'extinction de 45 secondes.
De quoi se faire Plaisir et essayer d'aider...
http://www.domo-attitude.fr
ledouble33
Messages : 286
Inscription : 07 févr. 2015, 07:45

Re: Alarme - Script LUA et notifications

Message par ledouble33 »

bonjour
je connais rien en lua
j essaye de faire une alarme ,j ai un:
capteur pirBureau ,un virtuel pirBureauDetection qui envoie les notification et un Virtuel AlarmeON.
quand j active "l alarmeOn", si je passe devant le capteur du bureau il fonction bien, mais il ne met pas sur On le "PirBureauDetection"
je comprend pas :cry:
mon script

Code : Tout sélectionner

commandArray = {}
      if (devicechanged['PirBureau'] == 'On') and otherdevices['AlarmeOn'] == 'On' then
	commandArray['PirBureauDetection'] = 'On'
         print('Alarme Enclenchée')
                  
      end
return commandArray
Pièces jointes
domo.PNG
domo.PNG (206.1 Kio) Consulté 8037 fois
thier
Messages : 807
Inscription : 26 sept. 2015, 10:32
Localisation : charente

Re: Alarme - Script LUA et notifications

Message par thier »

Ta parenthèse après le premier on est à déplacer après le deuxième on.
PI3+, Buster, Domoticz V2020.2, rflink, zwave, chauffage piloté par qubino, sondes oregon et Vil1d, boite aux lettres détection passage facteur, volets roulants qubino fibaro.
ledouble33
Messages : 286
Inscription : 07 févr. 2015, 07:45

Re: Alarme - Script LUA et notifications

Message par ledouble33 »

thier a écrit :Ta parenthèse après le premier on est à déplacer après le deuxième on.
Super
Merci ça fonctionne
ledouble33
Messages : 286
Inscription : 07 févr. 2015, 07:45

Re: Alarme - Script LUA et notifications

Message par ledouble33 »

j ai fini mon script lua fais avec mais faible connaissance en lua et surtout en copiant sur les autres :D
maintenant j active/desactive l ALARME par sms , je recois des notification pushbullet , des sms grace a smsgateway.
je sais pas s il y a des choses a corriger?
mais ca fonctionne.

Code : Tout sélectionner

--commandArray = {}
--      if (devicechanged['PirBureau'] == 'On') and otherdevices['AlarmeOn'] == 'On' then
--	commandArray['PirBureauDetection'] = 'On'
--         print('Alarme Enclenchée')
--commandArray['SendNotification']='PirBureau#attention#0#sound#extradata#pushbullet'
--                  
--     end
--return commandArray


commandArray = {}
 if (devicechanged['PirBureau'] == 'On' and otherdevices['AlarmeOn'] == 'On') then
    commandArray['SendNotification']='alarme maison#capteur mouvement Bureau#0#sound#extradata#pushbullet'
    commandArray['SendNotification']='#mouvementDansLeBureau#0#sound#extradata#http'
      print('Alarme mouvement dans le bureau')
 end

if (devicechanged['PirBuffet'] == 'On' and otherdevices['AlarmeOn'] == 'On') then
     commandArray['SendNotification']='alarme maison#capteur mouvement salon buffet#0#sound#extradata#pushbullet'
       commandArray['SendNotification']='#mouvementDansLeSalon#0#sound#extradata#http'
      print('Alarme mouvement dans le salon buffet')

 end

if (devicechanged['PirGarage'] == 'On' and otherdevices['AlarmeOn'] == 'On') then
     commandArray['SendNotification']='alarme maison#capteur mouvement garage entree#0#sound#extradata#pushbullet'
       commandArray['SendNotification']='#mouvementDansLeGarage#0#sound#extradata#http'
      print('Alarme mouvement dans le garage')

 end

if (devicechanged['PirEntree'] == 'On' and otherdevices['AlarmeOn'] == 'On') then
    commandArray['SendNotification']='alarme maison#capteur mouvement entree#0#sound#extradata#pushbullet'
       commandArray['SendNotification']='#mouvementDansLeEntree#0#sound#extradata#http'
    print('Alarme mouvement dans l entree')
 end

if (devicechanged['PirKeriuGarage'] == 'On' and otherdevices['AlarmeOn'] == 'On') then
     commandArray['SendNotification']='alarme maison#capteur mouvement garage escalier buffet#0#sound#extradata#pushbullet'
        commandArray['SendNotification']='#mouvementDansEscalierGarage#0#sound#extradata#http'
      print('Alarme mouvement dans les escalier')

 end


if (devicechanged['PorteGarage'] == 'On' and otherdevices['AlarmeOn'] == 'On') then
     commandArray['SendNotification']='alarme maison#porte garage ouverte#0#sound#extradata#pushbullet'
        commandArray['SendNotification']='#porteDeGarageOuverte#0#sound#extradata#http'
      print('Alarme porte garage ouverte')
 end

 if (devicechanged['PorteEntree'] == 'On' and otherdevices['AlarmeOn'] == 'On') then
     commandArray['SendNotification']='alarme maison#porte d entree ouverte#0#sound#extradata#pushbullet'
         commandArray['SendNotification']='#porteEntreeOuverte#0#sound#extradata#http'
      print('Alarme porte entrée ouverte')
 end

 if (devicechanged['PorteCuisine'] == 'On' and otherdevices['AlarmeOn'] == 'On') then
    commandArray['SendNotification']='alarme maison#porte cuisine ouverte#0#sound#extradata#pushbullet'
        commandArray['SendNotification']='#porteCuisineOuverte#0#sound#extradata#http'
      print('Alarme porte chambre ouverte')
 end

if (devicechanged['PorteChambre'] == 'On' and otherdevices['AlarmeOn'] == 'On') then
       commandArray['SendNotification']='alarme maison#porte chambre ouverte#0#sound#extradata#pushbullet'
          commandArray['SendNotification']='#porteChambreOuverte#0#sound#extradata#http'
      print('Alarme porte chambre ouverte')

 end

 if (devicechanged['PorteBaie'] == 'On' and otherdevices['AlarmeOn'] == 'On') then
     commandArray['SendNotification']='alarme maison#baie vitree  ouverte#0#sound#extradata#pushbullet'
         commandArray['SendNotification']='#porteBaieOuverte#0#sound#extradata#http'
      print('Alarme baie vitree ouverte')
 end


return commandArray
Répondre