Code lua pour notification Push
Re: Code lua pour notification Push
Bonjour,
Comment fait on pour avoir dans le message une variable utilisateur ? Je n'arrive pas à trouver la syntaxe...
Merci.
Comment fait on pour avoir dans le message une variable utilisateur ? Je n'arrive pas à trouver la syntaxe...
Merci.
Re: Code lua pour notification Push
Bonjour,
Voici un exemple de code
Au passage tu as aussi:
@+
Datawolf
Voici un exemple de code
Code : Tout sélectionner
local subsystem = "domoticz.NSS_PUSHBULLET"
--[[ Systèmes de notification disponibles :
NSS_GOOGLE_CLOUD_MESSAGING NSS_HTTP NSS_KODI NSS_LOGITECH_MEDIASERVER NSS_NMA NSS_PROWL NSS_PUSHALOT NSS_PUSHBULLET NSS_PUSHOVER NSS_PUSHSAFER
Pour une notification sur plusieurs systèmes, séparez les systèmes par une virgule.
Exemple :{domoticz.NSS_TELEGRAM, domoticz.NSS_HTTP}
--]]
variable = uservariables['MaVariableUtilisateur']
domoticz.notify('Titre', 'contenu='..variable, domoticz.PRIORITY_HIGH, ' ', ' ', subsystem)
Code : Tout sélectionner
domoticz.email('Titre', 'contenu='..variable, 'monadresse@gmail.com')Datawolf
Re: Code lua pour notification Push
Merci, mais c'est la synthaxe que je ne trouve pas.
Pour le moment j'ai :
Mais ca ne fonctionne pas.
Pour le moment j'ai :
Code : Tout sélectionner
if time.hour == 14 and time.min == 45
then
commandArray[#commandArray+1] = {['SendNotification'] = 'Waze # ..(string.format("%g",tostring(uservariables['Trajet-retour'])))..'°C' #0###pushover'}
endRe: Code lua pour notification Push
J'ai essayé ca en partant de ton extrait :
Mais dans les log j'ai ca "2018-12-06 15:17:54.531 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_device_waze-notification2.lua: ...omoticz/scripts/lua/script_device_waze-notification2.lua:7: attempt to index global 'time' (a nil value)"
Code : Tout sélectionner
commandArray = {}
if time.hour == 15 and time.min == 15
then
local subsystem = "domoticz.NSS_PUSHOVER"
--[[ Systèmes de notification disponibles :
NSS_GOOGLE_CLOUD_MESSAGING NSS_HTTP NSS_KODI NSS_LOGITECH_MEDIASERVER NSS_NMA NSS_PROWL NSS_PUSHALOT NSS_PUSHBULLET NSS_PUSHOVER NSS_PUSHSAFER
Pour une notification sur plusieurs systèmes, séparez les systèmes par une virgule.
Exemple :{domoticz.NSS_TELEGRAM, domoticz.NSS_HTTP}
--]]
variable = uservariables['Trajet-retour']
domoticz.notify('Waze', 'contenu='..variable, domoticz.PRIORITY_HIGH, ' ', ' ', subsystem)
end
return commandArrayRe: Code lua pour notification Push
Code : Tout sélectionner
time = os.date("%H:%M")
if time == '15:15'
then Re: Code lua pour notification Push
Merci on progresse main maintenant j'ai ca : "2018-12-06 15:55:30.051 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_device_waze-notification2.lua: ...omoticz/scripts/lua/script_device_waze-notification2.lua:17: attempt to index global 'domoticz' (a nil value)"
sur mon code :
sur mon code :
Code : Tout sélectionner
time = os.date("%H:%M")
commandArray = {}
if time == '15:55'
then
local subsystem = "domoticz.NSS_PUSHOVER"
--[[ Systèmes de notification disponibles :
NSS_GOOGLE_CLOUD_MESSAGING NSS_HTTP NSS_KODI NSS_LOGITECH_MEDIASERVER NSS_NMA NSS_PROWL NSS_PUSHALOT NSS_PUSHBULLET NSS_PUSHOVER NSS_PUSHSAFER
Pour une notification sur plusieurs systèmes, séparez les systèmes par une virgule.
Exemple :{domoticz.NSS_TELEGRAM, domoticz.NSS_HTTP}
--]]
variable = uservariables['Trajet-retour']
domoticz.notify('Waze', 'contenu='..variable, domoticz.PRIORITY_HIGH, ' ', ' ', subsystem)
end
return commandArrayRe: Code lua pour notification Push
Que dirais-tu d'un dzVents ?
Code : Tout sélectionner
return {
on = {
timer = { 'at 15:15', },
}
execute = function(domoticz, timer)
local subsystem = "domoticz.NSS_PUSHOVER"
--[[ Systèmes de notification disponibles :
NSS_GOOGLE_CLOUD_MESSAGING NSS_HTTP NSS_KODI NSS_LOGITECH_MEDIASERVER NSS_NMA NSS_PROWL NSS_PUSHALOT NSS_PUSHBULLET NSS_PUSHOVER NSS_PUSHSAFER
Pour une notification sur plusieurs systèmes, séparez les systèmes par une virgule.
Exemple :{domoticz.NSS_TELEGRAM, domoticz.NSS_HTTP}
--]]
variable = uservariables['Trajet-retour']
domoticz.notify('Waze', 'contenu='..variable, domoticz.PRIORITY_HIGH, ' ', ' ', subsystem)
end
}
Re: RE: Re: Code lua pour notification Push
Je ne connais pas du tout ce genre de programmation ça fait pas longtemps que j'ai découvert le lua.Datawolf a écrit :Que dirais-tu d'un dzVents ?
Code : Tout sélectionner
return { on = { timer = { 'at 15:15', }, } execute = function(domoticz, timer) local subsystem = "domoticz.NSS_PUSHOVER" --[[ Systèmes de notification disponibles : NSS_GOOGLE_CLOUD_MESSAGING NSS_HTTP NSS_KODI NSS_LOGITECH_MEDIASERVER NSS_NMA NSS_PROWL NSS_PUSHALOT NSS_PUSHBULLET NSS_PUSHOVER NSS_PUSHSAFER Pour une notification sur plusieurs systèmes, séparez les systèmes par une virgule. Exemple :{domoticz.NSS_TELEGRAM, domoticz.NSS_HTTP} --]] variable = uservariables['Trajet-retour'] domoticz.notify('Waze', 'contenu='..variable, domoticz.PRIORITY_HIGH, ' ', ' ', subsystem) end }
Ça se met ou ce fichier ? Y a un répertoire spécial comme pour les lua ?
Envoyé de mon Mi A1 en utilisant Tapatalk
Re: Code lua pour notification Push
Si tu as créé un sous-répertoire dans domoticz/scripts pour tes lua alors fais de même pour les dzvents.
Sinon tu les mets directement dans scripts.
Ou plus simplement, dans l'interface: Réglages>Plus d'options>Événements.
Sinon tu les mets directement dans scripts.
Ou plus simplement, dans l'interface: Réglages>Plus d'options>Événements.
Re: RE: Re: Code lua pour notification Push
Dans réglages, plus d'option, événement, c'est les blocky pas les dzevent ?Datawolf a écrit :Si tu as créé un sous-répertoire dans domoticz/scripts pour tes lua alors fais de même pour les dzvents.
Sinon tu les mets directement dans scripts.
Ou plus simplement, dans l'interface: Réglages>Plus d'options>Événements.
Envoyé de mon Mi A1 en utilisant Tapatalk