The Else if 0=1 is for "parking" unused bits of script as I' was getting fed up with deleting and recreating bits of script.
The ShutdownButton (gpio6) is normally High and goes Low when pressed. It is defined as a Push Off Button in Domoticz and as Both rising and falling edge in sys/gpio. When the button is pressed for just a second this is the log:
Code: Select all
2020-03-24 20:02:01.128 (Raspberry Pi 4 HMS) Lighting 2 (ShutDownButton)
2020-03-24 20:02:01.130 EventSystem: Event triggered: SDB_Test_1
2020-03-24 20:02:01.447 (Raspberry Pi 4 HMS) Lighting 2 (ShutDownButton)
2020-03-24 20:02:01.449 EventSystem: Event triggered: SDB_Test_2
2020-03-24 20:02:01.124 Status: Sysfs GPIO: gpio6 new state = off
2020-03-24 20:02:01.130 Status: If is triggerred
2020-03-24 20:02:01.442 Status: Sysfs GPIO: gpio6 new state = on
2020-03-24 20:02:01.449 Status: Else if if is triggered
2020-03-24 20:02:11.474 (StatusFlags) Light/Switch (ShutdownStatusEnd)
2020-03-24 20:02:18.469 (StatusFlags) Light/Switch (ShutdownStatusEnd)
2020-03-24 20:02:18.464 Status: User: Admin initiated a switch command (
Further the log entry "Else if if is triggered" should also never happen as both variables ShutdownStatusStart and ShutdownStatusEnd have been set to 1 and 0 respectively.
Note that my first version used dummy switches for ShutdownStatusStart and ShutdownStatusEnd and the behaviour was the same.
Code: Select all
2020-03-24 20:29:09.317 Status: EventSystem: reset all events...
2020-03-24 20:29:20.284 Status: EventSystem: reset all events...
2020-03-24 20:29:55.759 (Raspberry Pi 4 HMS) Lighting 2 (ShutDownButton)
2020-03-24 20:29:55.761 EventSystem: Event triggered: SDB_Test2_1
2020-03-24 20:29:55.804 (StatusFlags) Light/Switch (ShutdownStatusStart)
2020-03-24 20:29:55.808 (StatusFlags) Light/Switch (ShutdownStatusEnd)
2020-03-24 20:29:55.754 Status: Sysfs GPIO: gpio6 new state = off
2020-03-24 20:29:55.761 Status: If is triggerred
2020-03-24 20:29:55.761 Status: set End=On after 10 secs goes here
2020-03-24 20:29:56.244 (Raspberry Pi 4 HMS) Lighting 2 (ShutDownButton)
2020-03-24 20:29:56.245 EventSystem: Event triggered: SDB_Test2_2
2020-03-24 20:29:56.254 (StatusFlags) Light/Switch (ShutdownStatusStart)
2020-03-24 20:29:56.259 (StatusFlags) Light/Switch (ShutdownStatusEnd)
2020-03-24 20:29:56.239 Status: Sysfs GPIO: gpio6 new state = on
2020-03-24 20:29:56.245 Status: Else if if is triggered
2020-03-24 20:30:06.255 (StatusFlags) Light/Switch (ShutdownStatusEnd)
2020-03-24 20:30:17.932 (StatusFlags) Light/Switch (ShutdownStatusEnd
I'm tempted to do this in python script but I'm having problems accessing the gpio pins.
Thanks for reading.
Alan