Skip to content

Commit

Permalink
PiZigate initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
pipiche38 committed Jul 2, 2019
1 parent 4172d74 commit 011bf74
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
3 changes: 3 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release Notes

## 2 July 2019 - 4.3.5
- [Issue] - Remaining issue with PiZigate and gpio set. Should be closed now.

## 29 June 2019 - 4.3.4
- [Hardware] - Müller-Licht 44062 "tint white + color" (LED E27 9,5W 806lm 1.800-6.500K RGB).
- [Issue] - Fix an issue when seting gpio for PiZigate
Expand Down
32 changes: 26 additions & 6 deletions Tools/pi-zigate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,40 @@ then
echo "Usage: pi-zigate.sh flash | run "
exit 0
fi
echo "Verif GPIO ..."
io0=`gpio read 0`
io2=`gpio read 2`

if [ "$io0" -eq "1" ]
then
echo "+ GPIO 0 (RESET) $io0 --> OK"
else
echo "+ GPIO 0 (RESET) $io0 --> KO"
fi
if [ "$io2" -eq "1" ]
then
echo "+ GPIO 2 (FLASH) $io2 --> OK"
else
echo "+ GPIO 2 (FLASH) $io2 --> KO"
fi

if [ $1 == "flash" ]
then
echo "Switching PI-Zigate to Flash mode"

gpio mode 0 out
gpio mode 2 out
gpio write 2 0
gpio mode 0 down
gpio mode 0 up
gpio write 2 0
gpio write 0 0
gpio write 0 1
fi

if [ $1 == "run" ]
then
echo "Switching PI-Zigate to Run mode"
gpio mode 0 out
gpio mode 2 out
gpio write 2 1
gpio mode 0 down
gpio mode 0 up
gpio write 2 1
gpio write 0 0
gpio write 0 1
fi
10 changes: 8 additions & 2 deletions plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

"""
<plugin key="Zigate" name="Zigate plugin" author="zaraki673 & pipiche38" version="4.3.4" wikilink="https://www.domoticz.com/wiki/Zigate" externallink="https://github.com/sasu-drooz/Domoticz-Zigate/wiki">
<plugin key="Zigate" name="Zigate plugin" author="zaraki673 & pipiche38" version="4.3.5" wikilink="https://www.domoticz.com/wiki/Zigate" externallink="https://github.com/sasu-drooz/Domoticz-Zigate/wiki">
<description>
<h2> Plugin Zigate for Domoticz </h2><br/>
<h3> Short description </h3>
Expand Down Expand Up @@ -163,7 +163,7 @@ def __init__(self):

def onStart(self):

Domoticz.Status("Zigate plugin 4.3.4 started")
Domoticz.Status("Zigate plugin 4.3.5 started")

Domoticz.Log("Debug: %s" %int(Parameters["Mode6"]))
if Parameters["Mode6"] != "0":
Expand Down Expand Up @@ -270,6 +270,9 @@ def onStart(self):

GPIO_CMD = '/usr/bin/gpio'
if os.path.isfile( GPIO_CMD ):
os.system( GPIO_CMD + " read 0")
os.system( GPIO_CMD + " read 2")

Domoticz.Log(".")
os.system( GPIO_CMD + " mode 0 out")
Domoticz.Log(".")
Expand All @@ -280,6 +283,9 @@ def onStart(self):
os.system( GPIO_CMD + " write 0 0")
Domoticz.Log(".")
os.system( GPIO_CMD + " write 0 1")

os.system( GPIO_CMD + " read 0")
os.system( GPIO_CMD + " read 2")
else:
Domoticz.Error("%s command missing. Make sure to install wiringPi package" %GPIO_CMD)

Expand Down

0 comments on commit 011bf74

Please sign in to comment.