konnected-io / konnected-security

Konnected connects wired sensors and switches to SmartThings, Home Assistant, Hubitat and OpenHAB
https://konnected.io
Apache License 2.0
416 stars 322 forks source link

Relay triggers every time board reboots. #117

Closed qu3bec closed 4 years ago

qu3bec commented 4 years ago

After upgrading to 2.3.3 both garage door & siren turn on if board reboots. It’s working fine otherwise. Only momentary switch for garage door and siren connected to board. D5 momentary switch for garage door & D6 is set for Siren. It was all fine before upgrade. Low level trigger is checked in app for both devices. Has something changed in the firmware or file system?

qu3bec commented 4 years ago

This is the output from ESplorer if that helps - Konnected firmware 2.3.0 NodeMCU 2.2.0.0 build 20190805 powered by Lua 5.1.4 on SDK 2.2.1(6ab97e9) Heap: 41712 Initializing Konnected (2c3ae80b0c8d) Heap: 40352 Application Version: 2.3.3 Heap: 40088 Connecting to Wifi..

Heap: 41584 Wifi connected with IP: 192.168.1.12 Gateway: 192.168.1.1 Heap: 41736 Current Date/Time: 2019-12-21 22:59:54 UTC Heap: 41648 Booting Konnected application Heap: 41560 UPnP: Listening for UPnP discovery Heap: 41072 HTTP: Starting server at http://192.168.1.12:8724 Heap: 40896 Loaded: server Heap: 39216 Initializing actuator pin: 6 Heap: 39192 Initializing actuator pin: 5 Heap: 39152 Polling DHT on pin 3 every 180000ms Heap: 38920 DHT Status: -2 Heap: 38392 REST Endpoint: Heap: 38360 Loaded: application Heap: 38280 HTTP Call: 200 state 1 pin 6 Heap: 38216 Initialized actuator Pin: 6 Trigger: 0 Initial state: 1 Heap: 37776 HTTP Call: 200 state 1 pin 5 Heap: 37712 Initialized actuator Pin: 5 Trigger: 0 Initial state: 1 Heap: 35872 UPnP: Sent SSDP NOTIFY

heythisisnate commented 4 years ago

What type of relay are you using? Make sure the the relay trigger is also set to L(ow)

txgi108 commented 4 years ago

What type of relay are you using? Make sure the the relay trigger is also set to L(ow)

I had the same issue, flashed the board to 2.3.3 and both relays activated after the reboot. Using a DIY Kit and a 5V-2 Channel relay with the trigger set to Low. Just to test it out, I cycled power to the board and the same thing happened on restart.

heythisisnate commented 4 years ago

Make sure you have re-synced device settings after flashing

txgi108 commented 4 years ago

Yep, did that. The relays triggered after that...

Fortunately the Konnected Smart Home app still has 2.3.1. After I reverted, the issue went away.

I have the relays running my garage doors, so I can't have them opening every time the board reboots...

heythisisnate commented 4 years ago

hmm, will try to reproduce this

txgi108 commented 4 years ago

Thanks!!!

TazUk commented 4 years ago

I've also come across this today - the relay triggers every time I restart HomeAssistant or reboot the Konnected board. I'm using the relay as a momentary switch to arm and disarm my alarm, meaning that this is a major issue in my case.

Unfortunately I'm completely unable to downgrade my firmware from 2.3.3 - I've tried 7 different known good USB cables, and 5 different sets of drivers. Is there an alternative method available to force a downgrade?

TazUk commented 4 years ago

After trying 2 Windows 10 laptops, 7 usb cables and 5 different driver sets I managed to revert back to 2.3.1 using curl -X POST -H "Content-Type: application/json" -d '{"uri":"https://konnected-io.s3.us-east-2.amazonaws.com/esp8266-lfs/lfs-2.3.1.img"}' http://<konnectedip>:<port>/ota

Rolling back the Konnected software has completely resolved the issue.

heythisisnate commented 4 years ago

I was able to reproduce and confirm that this is a bug. It's fixed here: https://github.com/konnected-io/konnected-security/commit/d52b64983ae9bfbfe859766095cb314be00fe40e

This will be released in 2.3.4 within a few days.

The bug affects only low-level trigger relays, and causes them to momentarily trigger when the device is restarted.

TazUk commented 4 years ago

Hi,

My relay continues to trigger when rebooting the Konnected v2 add-on board and when restarting HomeAssistant. For my configuration, this means that the alarm is armed / disarmed with any restart or reboot - quite a critical issue for me. Happening both with release 2.3.4 and release 2.3.5, and HA version 107.x and (current) version 108.6

Not sure whether I should comment here or simply open a new issue, but as far as I can tell this has not resolved the problem which has been occurring with v2.3.3 and above releases.

heythisisnate commented 4 years ago

@TazUk Please confirm the trigger setting in the Konnected configuration matches the trigger on your relay. The easiest way to view the Konnected device's configuration is to download the Konnected app from the Apple / Google Play store, scan your network for the device, and then tap on "View device status". The trigger setting is shown in the actuators section of the status page.

0 = low 1 (or empty) = high

Make sure that your relay is configured accordingly. The relay modules that we sell have jumper to configure, but some relays may be fixed low or high.

Also -- what pin/zone do you have your relay connected to? Not all pins are compatible with high and low triggers.

TazUk commented 4 years ago

@heythisisnate

Nate, you were spot on.

Relay was jumpered to High, but my configuration was set to low.

After some messing around, I've reconfigured to 'High' in HA and checked that it passed through to the board from the app and ran a few restarts and all now behaves (relay triggers when board is first powered but I would expect that).

Interestingly trying to jumper the relay as low prevented the board from being accessible at all (from app or HA), so clearly high is the way to go for my setup.

I'm using the "OUT" terminal to fire the relay and using zones 1 to 3 to read some programmable outputs from the Texecom alarm panel it's wired to.


Apologies for my mistake and thanks again for the assist. This has been driving me nuts for weeks so with hindsight was bound to be something stupid at my end.