davidnewhall / indigo-8channel-relay

Indigo Plugin for 8 Channel Network Relay Board
MIT License
3 stars 4 forks source link

Sprinkler Bug Fixes and New Sprinkler Device States #8

Closed davidnewhall closed 5 years ago

davidnewhall commented 5 years ago

This contribution fixes a number of bugs introduced with the 1.0.0 release. Simply put, I forgot to push a commit and left out a number of necessary changes. On top of those misses, I found a couple other bugs and squashed those too. I feel like I've tested this thoroughly but always appreciate feedback from consumers.

Introduced four new device states: Schedule Running, Unexpected Zone Activates, Last Active Zone and Zone Last Active. The first state is a boolean and goes true when a sprinkler zone is requested to turn on by indigo. It goes false when all zones are requested off. If a zone unexpectedly activates, its name will be placed into the second state mentioned. This happens when something besides a sprinkler schedule triggers a relay on, that is assigned to a sprinkler zone. The last two states store the last zone that was on and (with a margin of error equal to the update interval) the time it turned off.

bsp9493 commented 5 years ago

LOL... it happens... figured there was something silly.

YAY!!!, works like a dream. I now have a fully functional irrigation controller with 2 spare relays (probably use one for garage door opener, not sure about the other one) - at a FRACTION of the cost of the commercial ones!

still trying to figure how I would use the inputs though:)

I did notice one thing... after creating the new devices (one for irrigation - 6 zones, and one for garage door - one relay) I did get the following errors in my log file.

Code: Select all Reloading plugin "8 Channel Network Relay 1.0.1" Stopping plugin "8 Channel Network Relay 1.0.1" (pid 35269) Stopped plugin "8 Channel Network Relay 1.0.1" Starting plugin "8 Channel Network Relay 1.0.1" (pid 35329) Started plugin "8 Channel Network Relay 1.0.1" 8 Channel Network Relay Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last): File "plugin.py", line 129, in runConcurrentThread File "plugin.py", line 351, in set_device_states ValueError: invalid literal for int() with base 10: ''

8 Channel Network Relay Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds) 8 Channel Network Relay Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last): File "plugin.py", line 129, in runConcurrentThread File "plugin.py", line 351, in set_device_states ValueError: invalid literal for int() with base 10: ''

8 Channel Network Relay Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds) 8 Channel Network Relay Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last): File "plugin.py", line 129, in runConcurrentThread File "plugin.py", line 351, in set_device_states ValueError: invalid literal for int() with base 10: ''

8 Channel Network Relay Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds) 8 Channel Network Relay Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last): File "plugin.py", line 129, in runConcurrentThread File "plugin.py", line 351, in set_device_states ValueError: invalid literal for int() with base 10: ''

8 Channel Network Relay Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds) 8 Channel Network Relay Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last): File "plugin.py", line 129, in runConcurrentThread File "plugin.py", line 351, in set_device_states ValueError: invalid literal for int() with base 10: ''

8 Channel Network Relay Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds) 8 Channel Network Relay Error Error in plugin execution ExecuteAction:

Traceback (most recent call last): File "plugin.py", line 137, in actionControlUniversal File "plugin.py", line 351, in set_device_states ValueError: invalid literal for int() with base 10: ''

8 Channel Network Relay Sent "irrigation controller - front lawn" off 8 Channel Network Relay Sent "irrigation controller - front shrubs" off 8 Channel Network Relay Sent "irrigation controller - front street" off 8 Channel Network Relay Sent "irrigation controller - back turf" off 8 Channel Network Relay Sent "irrigation controller - back dripline" off 8 Channel Network Relay Sent "irrigation controller - misters" off

however, it seems to settle out, and as you can see, the irrigation controller works just fine.

Thanx again for this!!!

AWESOME!!!!!

d

davidnewhall commented 5 years ago

Interesting. I'll try to figure that bug out too. haha. I just wish I had a better way to write tests for this code; I really have no idea how. Thanks you so much for your feedback, it really means a lot to me. Keep it coming!

davidnewhall commented 5 years ago

It looks like the activeZone device property is set to a blank string at creation. Once a command (like turn on or off a sprinkler zone) is sent, the property becomes an integer and the int() method stops throwing an error. I think I have a one-line fix for this, but the good news it's not a deal-breaker bug. As you noted, it will sort itself out. Once I can reproduce it, I'll know for sure that my fix solves it. I'll probably release a bug-fix later this week.