Bug Filed on 07-08-2016: Trigger Issue with Temperature/Relay Fish Tank Controller

What dashboard are you using? (Web, iOS, Android)
Web and Android

What OS? (Jessie, Wheezy)
Newest Jessie

What Model Pi?
Ver 2

Please describe the bug / issue. Attaching any relevant screenshots would be very helpful!

This may be hard to describe. I have setup a salt water reef tank controller using 1-wire temp sensors and solid state relays. The controller handles heaters, fans, lights and more. The issue i’m seeing is that when the system is rebooted and comes back online the triggers do not work if the if/then statement is already valid. EXAMPLE: the power goes out and the the tank and controller go offline. When the power is restored the tank water has dropped to 77 degrees and is too cold. i have a trigger setup that says if the tank water temp is less than 78 turn the heater relay on then once the the water is greater than 79 degrees the heater relay goes off. The problem is the heater relay never turns on! The only way to get the system back to normal function is to heat the sensor up in my hand past the 79 degree point and then let it drop to below 78. this turns on the relay that controls the heater and the system goes back to normal function. FYI the icon shows that it knows its too cold and the relay is on but it is not.

This happens the same if i heat the sensor up to where the fan is running (higher than 81) and reboot/boot the pi. The pi should boot and say it’s too hot and turn the fan to cool the system but it does not. i have to cool it back to below the trigger point and then raise it back to have it function normal and set the fan pin to high.

My guesses as to whats going on.

1 The system boots and sees the temperature is out of range and sets the the trigger in the web/android system but doe not reach the pi because the pi is slow and not ready to receive the command. (does the system have a check to actually see if the pin is high? )

2 The system is not setting a default variable for the trigger and thus never triggers until one is set by causing a new one to be set (holding the temp probe and causing it to heat up)

3 You tell me. :slight_smile:

Sorry this post was so long. It’s is really hard to explain the issue without all the detail.

Thanks - STEVE

Do you have a pull a up resistor in your one wire temp? if you have no problems whit temp reading and feeding those ssr, y think is kind of logic error between ssd state high/low and the trigger you are trying to pull up/down, how is your ssr state before pi reboots? try feeding the ssr whit comon ground and a external psu check current draw when driving high your relay.

just a though

PD. try change realy state under cayennes device options, relay state is shown in for eg: ligth status button if its high or low for on n off states, so yes it knows the gpio state

The other thing you can do is create some python code that runs at startup using the GPIO library to initialize your IO.

Kind of makes me want to advocate for external serial bus IO modules for everything with a separate battery backed up supply to maintain states.

Craig

Solid state relays work perfect and current draw is nothing. Already on a common ground. i changed to a standard relay on an external power supply to test further and same results. This looks to be a bug with how Cayenne sets the default variables or the lack of setting them. Its like nothing is know until it is set. I’m going to try this with a time based policy and see if it works. try some of your own and let me know. To test reboot it and make sure the statement is true and my guess is cayenne will not register it as accurate. bummed this is the only reason i can’t currently use cayenne for lots of projects. As for writting a script i can do that it will just take a while as in this case i’ll have to grep the current temp and set the pin based on that low or high then find some way for the two commands not to bash heads.

1 Like

HI @stevescomputer,

Welcome to the Cayenne community! Thanks for bringing this up. To be honest, I haven’t tested what happens during reboot, certainly though I see the use case here. We’ll have to test this out on our end to see if we can reproduce what you are experiencing.

Not that this is related, but we’ll be looking into this issue as well.

-B

@stevescomputer right…

There is a bug in the triggers. I have used two simple trigger for fan control depending on the ambient temperature (DS18B20 connected to RPi, temp reading OK), For example, when T>30 - fan enabled, T<27 - the fan is switched off. Initially, everything worked correctly…

But at some point (unfortunately I could not keep track of this momment) the fan stays on and triggers were not run. In the manual mode, I can turn on / off the fan, how to use the widget as well as in GPIO. Even after reboot, after removing the triggers and writing new ones - no reaction to changes in temperature sensor…

Check to see if things go wrong after reboot when the temperature is let say T>30. In this case after the Pi boots the fan should come on but it does not in my case. if you chill the sensor to below 30 then raise it again the fan will come on in my experience.

The actual bug is when a trigger is valid on boot of your device the GPIO pin is not set to High or low depending on your rules. The web interface shows that it sees the temp is too high and the fan graphic is on but does not actually set the pin high.

I can not at this time to check these conditions because I have a trigger on a temperature generally stopped working … :worried: LOG In triggers menu: Trigger Created, Run 0 Times…

I did everything possible - rebooted RPi, remove the sensor / widget and plug it in again, I removed the triggers and wrote them again - no response to temperature changes. Temperature reading from the sensor - normally.

I reinstall the Raspbian and Cayenne to another SD memory card (now it’s the third) - it worked stably. Triggers also worked correctly. But…

Really after reboot when the temperature is > 30 (in my case T>30 should be enable Fan) GPIO pin is not set High.

did you fix the problem? i’m having the same problem when rebooting the device that the triggers don’t work so i always have to login to cayenne to click the trigger off and then on again. it’s really annoying!

I never fixed it I ended up switching to just straight python programming
for my solid state relay controller. And sad to say right now I don’t have
any Cayenne projects after I sold my large saltwater fish tank.

What relay board are you using? Seems strange that it works to trigger, but won’t turn off the relay.

Note that the off state of the Pi on some relay boards is enough to keep weak current on the relay and hold it in the on state.

…or it could be software. I can try and confirm if there is a bug on the weekend.

Cheers,

Craig