[DzVents]premier essai, Allumage LED avec Bouton SonOff SNZB-01
Publié : 17 avr. 2022, 05:24
Salut
Bon je me lance et j'essaye, j'avoue complétement a tâtons mais on verra bien
et ceux malgré avoir lu et relu les liens fournit par Keros
alors explication avant de commencer
je possède un bouton sonoff avec lequel je souhaiterais allumer et éteindre un bandeau LED
ce bandeau LED est un RGBW Zigbee reconnu par domoticz en tant que dimmer
bien sur, ils sont bien coupler a DomoticZ
voici le code que j'ai essayé de créer
je teste donc le fonctionnement et voici ce que les logs m'annonce
Aucune erreur n'est annoncé dans les logs mais problème, le bandeau LED ne s'allume pas
j'ai aussi essayé ainsi mais la j'ai des erreurs qui s'annoncent
j'ai beau lire et relire les tutos, l'écriture en elle même de la programmation reste du chinois
je comprends le principe du fonctionnement pour avoir survolé l'automatisation des machines pour mon niveau BACpro Electro
d’où je penses une plus grande facilité d'utilisation du Blocky mais avec toujours de grosses lacunes
Pourriez vous m’aiguiller dans mon incompétence
Et pourriez vous me dire si les commentaires que j'ai ajoutés sont bon ou pas
Et vous pourriez ajouter les commentaires manquants et expliquer ceux commentés mais avec ????
Merci d'avance
Bon je me lance et j'essaye, j'avoue complétement a tâtons mais on verra bien
et ceux malgré avoir lu et relu les liens fournit par Keros
alors explication avant de commencer
je possède un bouton sonoff avec lequel je souhaiterais allumer et éteindre un bandeau LED
ce bandeau LED est un RGBW Zigbee reconnu par domoticz en tant que dimmer
bien sur, ils sont bien coupler a DomoticZ
voici le code que j'ai essayé de créer
Code : Tout sélectionner
return { -- ???
on = { --
devices = { -- liste des devices
'Mini_Inter', -- noms des devices utilisés
}
},
logging = { -- ???
level = domoticz.LOG_DEBUG, -- le script écrit dans les LOG_DEBUG de DomoticZ(Décommentez pour remplacer le paramètre de journalisation globale dzVents)
marker = 'Mini_Inter_LED_Lidl' -- nom du script
},
execute = function(domoticz, bouton) -- exécuter la fonction bouton ????
domoticz.log("Mini_Inter : "..bouton.state) -- vérifier l'état de Mini_Inter dans les logs DomoticZ
if(bouton.state == 'simple_pression')then -- SI l'état de Mini_Inter passe a simple_pression ALORS
domoticz.devices('LED_Lidl').switchSelector("on") -- allumer device LED_Lidl
elseif(bouton.state == 'double_pression')then -- SINON SI l'état de Mini_Inter passe a double_pression ALORS
--rien -- ne rien faire
elseif(bouton.state == 'Longue_pression')then -- SINON SI l'état de Mini_Inter passe a longue_pression ALORS
domoticz.devices('LED_Lidl').switchSelector("off") -- éteindre device LED_Lidl
end -- fin des conditions ????
end -- fin de la fonction ????
}Code : Tout sélectionner
2022-04-17 04:50:13.085 Notification sent (browser) => Success
2022-04-17 04:50:13.084 Status: Notification: simple_pression
2022-04-17 04:50:13.209 Status: dzVents: Info: Handling events for: "Mini_Inter", value: "Simple"
2022-04-17 04:50:13.209 Status: dzVents: Info: Mini_Inter_LED_Lidl: ------ Start internal script: Script #1: Device: "Mini_Inter (Zigbee2mqtt_Sonoff)", Index: 23
2022-04-17 04:50:13.209 Status: dzVents: Info: Mini_Inter_LED_Lidl: Mini_Inter : Simple
2022-04-17 04:50:13.210 Status: dzVents: Info: Mini_Inter_LED_Lidl: ------ Finished Script #1
2022-04-17 04:50:24.967 Notification sent (browser) => Success
2022-04-17 04:50:24.962 Status: Notification: longue_pression
2022-04-17 04:50:25.063 Status: dzVents: Info: Handling events for: "Mini_Inter", value: "Long"
2022-04-17 04:50:25.063 Status: dzVents: Info: Mini_Inter_LED_Lidl: ------ Start internal script: Script #1: Device: "Mini_Inter (Zigbee2mqtt_Sonoff)", Index: 23
2022-04-17 04:50:25.063 Status: dzVents: Info: Mini_Inter_LED_Lidl: Mini_Inter : Long
2022-04-17 04:50:25.063 Status: dzVents: Info: Mini_Inter_LED_Lidl: ------ Finished Script #1 j'ai aussi essayé ainsi mais la j'ai des erreurs qui s'annoncent
Code : Tout sélectionner
return { -- ???
on = { --
devices = { -- liste des devices
'Mini_Inter', -- noms des devices utilisés
}
},
logging = { -- ???
level = domoticz.LOG_DEBUG, -- le script écrit dans les LOG_DEBUG de DomoticZ(Décommentez pour remplacer le paramètre de journalisation globale dzVents)
marker = 'Mini_Inter_LED_Lidl' -- nom du script
},
execute = function(domoticz, bouton) -- exécuter la fonction bouton ????
domoticz.log("Mini_Inter : "..bouton.state) -- vérifier l'état de Mini_Inter dans les logs DomoticZ
if(bouton.state == 'Simple')then -- SI l'état de Mini_Inter passe a simple_pression ALORS
domoticz.devices('LED_Lidl').switchSelector("on") -- allumer device LED_Lidl
elseif(bouton.state == 'Double')then -- SINON SI l'état de Mini_Inter passe a double_pression ALORS
--rien -- ne rien faire
elseif(bouton.state == 'Long')then -- SINON SI l'état de Mini_Inter passe a longue_pression ALORS
domoticz.devices('LED_Lidl').switchSelector("off") -- éteindre device LED_Lidl
end -- fin des conditions ????
end -- fin de la fonction ????
}Code : Tout sélectionner
2022-04-17 05:10:01.224 Notification sent (browser) => Success
2022-04-17 05:10:01.223 Status: Notification: simple_pression
2022-04-17 05:10:01.311 Status: dzVents: Info: Handling events for: "Mini_Inter", value: "Simple"
2022-04-17 05:10:01.311 Status: dzVents: Info: Mini_Inter_LED_Lidl: ------ Start internal script: Script #2: Device: "Mini_Inter (Zigbee2mqtt_Sonoff)", Index: 23
2022-04-17 05:10:01.311 Status: dzVents: Info: Mini_Inter_LED_Lidl: Mini_Inter : Simple
2022-04-17 05:10:01.312 Status: dzVents: Debug: Mini_Inter_LED_Lidl: Processing device-adapter for LED_Lidl: RGB(W) device adapter
2022-04-17 05:10:01.312 Status: dzVents: Debug: Mini_Inter_LED_Lidl: Processing device-adapter for LED_Lidl: Switch device adapter
2022-04-17 05:10:01.312 Status: dzVents: Info: Mini_Inter_LED_Lidl: ------ Finished Script #2
2022-04-17 05:10:01.312 Error: dzVents: Error: (3.1.8) Mini_Inter_LED_Lidl: An error occurred when calling event handler Script #2
2022-04-17 05:10:01.312 Error: dzVents: Error: (3.1.8) Mini_Inter_LED_Lidl: ...moticz/dzVents/runtime/device-adapters/switch_device.lua:131: attempt to get length of a nil value (field 'levelNames')
2022-04-17 05:10:10.524 Notification sent (browser) => Success
2022-04-17 05:10:10.522 Status: Notification: longue_pression
2022-04-17 05:10:10.650 Status: dzVents: Info: Handling events for: "Mini_Inter", value: "Long"
2022-04-17 05:10:10.650 Status: dzVents: Info: Mini_Inter_LED_Lidl: ------ Start internal script: Script #2: Device: "Mini_Inter (Zigbee2mqtt_Sonoff)", Index: 23
2022-04-17 05:10:10.650 Status: dzVents: Info: Mini_Inter_LED_Lidl: Mini_Inter : Long
2022-04-17 05:10:10.651 Status: dzVents: Debug: Mini_Inter_LED_Lidl: Processing device-adapter for LED_Lidl: RGB(W) device adapter
2022-04-17 05:10:10.651 Status: dzVents: Debug: Mini_Inter_LED_Lidl: Processing device-adapter for LED_Lidl: Switch device adapter
2022-04-17 05:10:10.651 Status: dzVents: Info: Mini_Inter_LED_Lidl: ------ Finished Script #2
2022-04-17 05:10:10.651 Error: dzVents: Error: (3.1.8) Mini_Inter_LED_Lidl: An error occurred when calling event handler Script #2
2022-04-17 05:10:10.651 Error: dzVents: Error: (3.1.8) Mini_Inter_LED_Lidl: ...moticz/dzVents/runtime/device-adapters/switch_device.lua:131: attempt to get length of a nil value (field 'levelNames') je comprends le principe du fonctionnement pour avoir survolé l'automatisation des machines pour mon niveau BACpro Electro
d’où je penses une plus grande facilité d'utilisation du Blocky mais avec toujours de grosses lacunes
Pourriez vous m’aiguiller dans mon incompétence
Et pourriez vous me dire si les commentaires que j'ai ajoutés sont bon ou pas
Et vous pourriez ajouter les commentaires manquants et expliquer ceux commentés mais avec ????
Merci d'avance