Page 1 sur 1

Switchbot et domoticz

Publié : 02 sept. 2020, 16:48
par Bond5410
Bonjour je viens de faire une box domotique sous domoticz et je cherche donc a mettre mes équipements dessus j'ai un switchbot comme celui-ci https://urlz.fr/dJav et trois autres comme cela https://urlz.fr/dJax des idées ? j'ai trouver l'IP mais je n'ai pas les commandes pour le premier

Re: Switchbot et domoticz

Publié : 02 sept. 2020, 17:50
par Bond5410

Re: Switchbot et domoticz

Publié : 20 nov. 2022, 12:26
par Abbij
Bonjour

Je me permets de relancer le sujet
Avez-vous trouvé une solution?

D'avance merci ;)

Re: Switchbot et domoticz

Publié : 30 mars 2023, 23:02
par psytgc
Bonsoir
je déterre un peu, mais j'ai réussi à actionner un switchbot en bluetooth à partir d'un orangepi
j'ai utilisé ce tuto :
https://github.com/OpenWonderLabs/pytho ... /README.md

Du coup j'aimerais incorporer un bouton interrupteur qui actionne ce switch dans domoticz.
Les commandes sudo python3 switchbot_py3.py -d F9:38:1F:6E:12:33 -c on et
sudo python3 switchbot_py3.py -d F9:38:1F:6E:12:33 -c off
fonctionnent en ssh , maintenant je ne sais pas comment les incorporer dans domoticz pour les exécuter sans erreur genre 32512.

Pouvez-vous m'aider?
Merci

Re: Switchbot et domoticz

Publié : 31 mars 2023, 22:57
par psytgc
Bonsoir

Et bien merci chat GPT4

voici le script Lua qui fonctionne :

Code : Tout sélectionner

commandArray = {}

-- Define the device that will trigger the script
local switchbot_device = 'switchbot'

-- Define the Python command to execute
local switchbot_cmd = ''
if (devicechanged[switchbot_device] == 'On') then
    switchbot_cmd = 'python3 /home/orangepi/python-host/switchbot_py3.py -d F9:38:1F:6E:12:63 -c on'
elseif (devicechanged[switchbot_device] == 'Off') then
    switchbot_cmd = 'python3 /home/orangepi/python-host/switchbot_py3.py -d F9:38:1F:6E:12:63 -c off'
end

-- Execute the Python command if it's defined
if (switchbot_cmd ~= '') then
    os.execute(switchbot_cmd)
    print('SwitchBot command executed: ' .. switchbot_cmd)
end

return commandArray
remplacez switchbot par le nom de votre interrupteur et les chemins vers le script en.py

Vraiment trop fort ce chat GPT