Page 2 sur 2

Re: Alarme - Script LUA et notifications

Publié : 04 nov. 2016, 10:55
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)

Re: Alarme - Script LUA et notifications

Publié : 04 nov. 2016, 12:47
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) ;)

Re: Alarme - Script LUA et notifications

Publié : 07 nov. 2016, 16:13
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

Re: Alarme - Script LUA et notifications

Publié : 07 nov. 2016, 20:53
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.

Re: Alarme - Script LUA et notifications

Publié : 21 déc. 2017, 19:31
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

Re: Alarme - Script LUA et notifications

Publié : 22 déc. 2017, 11:25
par thier
Ta parenthèse après le premier on est à déplacer après le deuxième on.

Re: Alarme - Script LUA et notifications

Publié : 22 déc. 2017, 23:09
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

Re: Alarme - Script LUA et notifications

Publié : 23 déc. 2017, 17:05
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