reef-pi :: An opensource reef tank controller based on Raspberry Pi.

Ryan115

Well-Known Member
View Badges
Joined
Dec 28, 2010
Messages
586
Reaction score
1,085
Location
Mississippi
Rating - 0%
0   0   0
Oh, that’s unfortunate . I’m glad that livestock is ok.
I am kinda sad to realize that reef-pi did not reset the equipment states upon boot. This is an unacceptable bug and has to be fixed before 1.0 release. I was under the impression that I already have the code that does this, because it’s logical and important, but I cannot see relevant code :-(. I want to say sorry and thank you for bringing this up. I’ll patch reef-pi by tonight. This feature (sync all equipment to desired state upon boot) will be in 1.0 release
Thanks, Ranjib.
Let me know if you need further testing on this end.
Forgot to mention, I am still running 0.9.1. Not sure if things were fixed in 0.9.2 though.
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,058
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Thanks, Ranjib.
Let me know if you need further testing on this end.
Forgot to mention, I am still running 0.9.1. Not sure if things were fixed in 0.9.2 though.
It’s not fixed yet, I am writing a patch now..
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,058
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0

sector9

Active Member
View Badges
Joined
Jun 26, 2017
Messages
129
Reaction score
190
Rating - 0%
0   0   0
I wired up my ATO optical sensor on breadboard today. I am getting the opposite logic for Reef-pi than I expect. If the sensor is in the water, reef-pi turns on the switch for my ATO pump. If the sensor is out of the water, it turns off.

Reef-pi log is showing that the sensor state is "1" when the sensor is out of the water and the sensor state is "0" when the sensor is in the water. Is this the expected input?
 

Ryan115

Well-Known Member
View Badges
Joined
Dec 28, 2010
Messages
586
Reaction score
1,085
Location
Mississippi
Rating - 0%
0   0   0
Are your outlets wired as normally-open (NO) or normally-closed (NC)? If they are turning on with a logic state of 1, then it sounds like NO.
When the outlets were set up did you select the "reverse" button on the configuration. reef-pi expects NO outlets, so the "reverse" is for NC outlets.
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,058
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
I wired up my ATO optical sensor on breadboard today. I am getting the opposite logic for Reef-pi than I expect. If the sensor is in the water, reef-pi turns on the switch for my ATO pump. If the sensor is out of the water, it turns off.

Reef-pi log is showing that the sensor state is "1" when the sensor is out of the water and the sensor state is "0" when the sensor is in the water. Is this the expected input?
As @Ryan115 mentioned, cross check your relay wiring. It is possible that there is a bug in the ATO code or the probe you have work opposite (not very likely). If possible, can you share your relay wiring and the probe details (if its not sourced from dfrobot).
 

sector9

Active Member
View Badges
Joined
Jun 26, 2017
Messages
129
Reaction score
190
Rating - 0%
0   0   0
Are your outlets wired as normally-open (NO) or normally-closed (NC)? If they are turning on with a logic state of 1, then it sounds like NO.
When the outlets were set up did you select the "reverse" button on the configuration. reef-pi expects NO outlets, so the "reverse" is for NC outlets.

As @Ryan115 mentioned, cross check your relay wiring. It is possible that there is a bug in the ATO code or the probe you have work opposite (not very likely). If possible, can you share your relay wiring and the probe details (if its not sourced from dfrobot).

Thanks for the help. I have my relays wired in the NC configuration and I do have the "reverse" option checked. The outlets are all working as intended on the "Equipment" tab i.e. they are on when Reef-pi says they are on etc. I am using a cheap generic optical sensor off of ebay (like this https://www.ebay.com/itm/Water-Liqu...897133?hash=item361ba2f02d:g:Bj8AAOSwjvJZVa70). With this particular optical sensor, it seems to be returning the opposite value as Reef-pi expects. Here are some examples from the log:

***sticks sensor in water***
Dec 10 14:15:17 reefpi reef-pi[4742]: 2017/12/10 14:15:17 ATO sensor value: 0
Dec 10 14:15:17 reefpi reef-pi[4742]: 2017/12/10 14:15:17 Setting GPIO Pin: 13 State: 0
Dec 10 14:15:17 reefpi reef-pi[4742]: 2017/12/10 14:15:17 Switched on ATO pump
***ATO pumps turns on***

***takes sensor out of water***
Dec 10 14:16:17 reefpi reef-pi[4742]: 2017/12/10 14:16:17 ATO sensor value: 1
Dec 10 14:16:17 reefpi reef-pi[4742]: 2017/12/10 14:16:17 Setting GPIO Pin: 13 State: 1
Dec 10 14:16:17 reefpi reef-pi[4742]: 2017/12/10 14:16:17 Switched off ATO pump
***ATO pumps turns off***

So reef-pi seems to have the correct logic for when the ATO pump is on and off. However, the sensor value seems to be opposite what reef-pi is expecting. Here is the circuit I am using:

--20150609143622.jpg


As a temporary fix, I could switch this one outlet to not be "reversed" to trick reef-pi into turning on the pump when it is meaning to turn off the pump and vice versa
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,058
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Thanks for the help. I have my relays wired in the NC configuration and I do have the "reverse" option checked. The outlets are all working as intended on the "Equipment" tab i.e. they are on when Reef-pi says they are on etc. I am using a cheap generic optical sensor off of ebay (like this https://www.ebay.com/itm/Water-Liqu...897133?hash=item361ba2f02d:g:Bj8AAOSwjvJZVa70). With this particular optical sensor, it seems to be returning the opposite value as Reef-pi expects. Here are some examples from the log:

***sticks sensor in water***
Dec 10 14:15:17 reefpi reef-pi[4742]: 2017/12/10 14:15:17 ATO sensor value: 0
Dec 10 14:15:17 reefpi reef-pi[4742]: 2017/12/10 14:15:17 Setting GPIO Pin: 13 State: 0
Dec 10 14:15:17 reefpi reef-pi[4742]: 2017/12/10 14:15:17 Switched on ATO pump
***ATO pumps turns on***

***takes sensor out of water***
Dec 10 14:16:17 reefpi reef-pi[4742]: 2017/12/10 14:16:17 ATO sensor value: 1
Dec 10 14:16:17 reefpi reef-pi[4742]: 2017/12/10 14:16:17 Setting GPIO Pin: 13 State: 1
Dec 10 14:16:17 reefpi reef-pi[4742]: 2017/12/10 14:16:17 Switched off ATO pump
***ATO pumps turns off***

So reef-pi seems to have the correct logic for when the ATO pump is on and off. However, the sensor value seems to be opposite what reef-pi is expecting. Here is the circuit I am using:

--20150609143622.jpg


As a temporary fix, I could switch this one outlet to not be "reversed" to trick reef-pi into turning on the pump when it is meaning to turn off the pump and vice versa
Thank you for sharing the details. I would have suggested the same workaround that you have opted for. I am thinking out loud, whats the best way to solve this. Should I introduce a "reverse" option on the ATO module?
 

Ryan115

Well-Known Member
View Badges
Joined
Dec 28, 2010
Messages
586
Reaction score
1,085
Location
Mississippi
Rating - 0%
0   0   0
Ranjib,
I am attempting to setup email/text alerts for reef-pi, and trying to figure out what is missing on my settings.

On the telemetry panel I have enable email alerts...
limit per hour: 10
server: smtp.gmail.com
port: 587
from: my gmail address (*****@gmail.com)
to: my phone number **********@vtext.com

On the temperature tab I have set it to send alerts and have a threshold that should send a message.

Here is the log...
Code:
Dec 10 15:09:19 raspberrypi reef-pi[295]: 2017/12/10 15:09:19 WARNING: Alert is above throttle limits. Skipping. Subject:%!(EXTRA string=[Reef-Pi ALERT] temperature out of range)
Dec 10 15:09:19 raspberrypi reef-pi[295]: 2017/12/10 15:09:19 Temperature sensor value: 77
Dec 10 15:09:20 raspberrypi reef-pi[295]: 2017/12/10 15:09:20 Temperature subsystem - switching heater: false
Dec 10 15:09:21 raspberrypi reef-pi[295]: 2017/12/10 15:09:21 Setting GPIO Pin: 13 State: 1
Dec 10 15:09:24 raspberrypi reef-pi[295]: 2017/12/10 15:09:24 lighting-subsystem: Setting PWM value: 28  at channel: 0
Dec 10 15:09:26 raspberrypi reef-pi[295]: 2017/12/10 15:09:26 lighting-subsystem: Setting PWM value: 57  at channel: 1
Dec 10 15:09:54 raspberrypi reef-pi[295]: 2017/12/10 15:09:54 lighting-subsystem: Setting PWM value: 28  at channel: 0
Dec 10 15:09:58 raspberrypi reef-pi[295]: 2017/12/10 15:09:58 lighting-subsystem: Setting PWM value: 57  at channel: 1
Dec 10 15:10:24 raspberrypi reef-pi[295]: 2017/12/10 15:10:24 lighting-subsystem: Setting PWM value: 28  at channel: 0
Dec 10 15:10:25 raspberrypi reef-pi[295]: 2017/12/10 15:10:25 lighting-subsystem: Setting PWM value: 57  at channel: 1
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,058
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Ranjib,
I am attempting to setup email/text alerts for reef-pi, and trying to figure out what is missing on my settings.

On the telemetry panel I have enable email alerts...
limit per hour: 10
server: smtp.gmail.com
port: 587
from: my gmail address (*****@gmail.com)
to: my phone number **********@vtext.com

On the temperature tab I have set it to send alerts and have a threshold that should send a message.

Here is the log...
Code:
Dec 10 15:09:19 raspberrypi reef-pi[295]: 2017/12/10 15:09:19 WARNING: Alert is above throttle limits. Skipping. Subject:%!(EXTRA string=[Reef-Pi ALERT] temperature out of range)
Dec 10 15:09:19 raspberrypi reef-pi[295]: 2017/12/10 15:09:19 Temperature sensor value: 77
Dec 10 15:09:20 raspberrypi reef-pi[295]: 2017/12/10 15:09:20 Temperature subsystem - switching heater: false
Dec 10 15:09:21 raspberrypi reef-pi[295]: 2017/12/10 15:09:21 Setting GPIO Pin: 13 State: 1
Dec 10 15:09:24 raspberrypi reef-pi[295]: 2017/12/10 15:09:24 lighting-subsystem: Setting PWM value: 28  at channel: 0
Dec 10 15:09:26 raspberrypi reef-pi[295]: 2017/12/10 15:09:26 lighting-subsystem: Setting PWM value: 57  at channel: 1
Dec 10 15:09:54 raspberrypi reef-pi[295]: 2017/12/10 15:09:54 lighting-subsystem: Setting PWM value: 28  at channel: 0
Dec 10 15:09:58 raspberrypi reef-pi[295]: 2017/12/10 15:09:58 lighting-subsystem: Setting PWM value: 57  at channel: 1
Dec 10 15:10:24 raspberrypi reef-pi[295]: 2017/12/10 15:10:24 lighting-subsystem: Setting PWM value: 28  at channel: 0
Dec 10 15:10:25 raspberrypi reef-pi[295]: 2017/12/10 15:10:25 lighting-subsystem: Setting PWM value: 57  at channel: 1
It means reef-pi is not sending the alerts due to the limit. It also means reef-pi has already sent 10 alert. Following are the few diagnostics you can do:
1) Check in gmail sent email folder, if gmail has actually sent those emails. There should be ten such emails. reef-pi log should have those details as well. If thats the case. then reef-pi is working, but somehow mobile to sms gateway is not working
2) If you dont see those sent emails, that means reef-pi is not working. Check reef-pi log for previous alert attemps.. if they have any error etc..

I have recently published the documentation on telemetry, and alert setup in one part of it. Check if that help: https://reef-pi.github.io/build-guides/telemetry/
..
I can see there is a reef-pi bug on log formatting as well it should not impact the logic though..
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,058
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
It means reef-pi is not sending the alerts due to the limit. It also means reef-pi has already sent 10 alert. Following are the few diagnostics you can do:
1) Check in gmail sent email folder, if gmail has actually sent those emails. There should be ten such emails. reef-pi log should have those details as well. If thats the case. then reef-pi is working, but somehow mobile to sms gateway is not working
2) If you dont see those sent emails, that means reef-pi is not working. Check reef-pi log for previous alert attemps.. if they have any error etc..

I have recently published the documentation on telemetry, and alert setup in one part of it. Check if that help: https://reef-pi.github.io/build-guides/telemetry/
..
I can see there is a reef-pi bug on log formatting as well it should not impact the logic though..
I cross checked the alert throttling logic in reef-pi, and could not spot any bug. Also, used it an excuse to add a throttle specific test, and fixed the log formatting issue.
https://github.com/reef-pi/reef-pi/pull/263
 

Ryan115

Well-Known Member
View Badges
Joined
Dec 28, 2010
Messages
586
Reaction score
1,085
Location
Mississippi
Rating - 0%
0   0   0
It means reef-pi is not sending the alerts due to the limit. It also means reef-pi has already sent 10 alert. Following are the few diagnostics you can do:
1) Check in gmail sent email folder, if gmail has actually sent those emails. There should be ten such emails. reef-pi log should have those details as well. If thats the case. then reef-pi is working, but somehow mobile to sms gateway is not working
2) If you dont see those sent emails, that means reef-pi is not working. Check reef-pi log for previous alert attemps.. if they have any error etc..

I have recently published the documentation on telemetry, and alert setup in one part of it. Check if that help: https://reef-pi.github.io/build-guides/telemetry/
..
I can see there is a reef-pi bug on log formatting as well it should not impact the logic though..
I did just go into my gmail settings and enabled IMAP.
However, I also upped my message limit to 20 per hour (currently I am checking temp every 5, so I shouldnt be able to have more than 12 alerts/hour), I am still getting the message that alert is above throttle limits.
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,058
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
I did just go into my gmail settings and enabled IMAP.
However, I also upped my message limit to 20 per hour (currently I am checking temp every 5, so I shouldnt be able to have more than 12 alerts/hour), I am still getting the message that alert is above throttle limits.
You have to reload reef-pi for any changes in configuration to take effect.
gmail requires application specific password, other than. I am not sure if you need imap enabled. Try generating the password using the link i have mentioned in the doc, luckily its ,gmail specific and see if that fixes the issue. Did you check reef-pi log for prior alerts?
 

Ryan115

Well-Known Member
View Badges
Joined
Dec 28, 2010
Messages
586
Reaction score
1,085
Location
Mississippi
Rating - 0%
0   0   0
After restarting reef-pi to implement the changes, it looks like the problem is on the gmail side.
However, when I go to the link to generate an app password, it tells me that it is unavailable for my account.
I just allowed access "from less secure apps", but so far nothing has come through yet. Still working on it...

nevermind...working now!
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,058
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
After restarting reef-pi to implement the changes, it looks like the problem is on the gmail side.
However, when I go to the link to generate an app password, it tells me that it is unavailable for my account.
I just allowed access "from less secure apps", but so far nothing has come through yet. Still working on it...

nevermind...working now!
Awesome!
Thanks for the testing effort.
 

Somnifac

Active Member
View Badges
Joined
Oct 6, 2017
Messages
141
Reaction score
378
Rating - 0%
0   0   0
Everyone interested in 3D printing panels for mounting their plugs and jacks:

As I've said before, I found that the enclosure I wanted to use was too thick for panel mounted jacks (BNC, RCA, and 3.5mm). So, I decided to 3D print panels which will mount in/on the surface of the enclosure. I'll just need to cut a single, neat rectangular hole where the panel will be mounted. Easy enough. The panel has holes for 4x 3.5mm jacks 1/4" jacks that can accommodate typical 3.5mm jacks, and 6x 10mm holes that can accommodate any combination of RCA and/or BNC connectors. The holes are numbered 1 - 9, and "X" for 10 (for hole clearance, as well as digit symmetry) on the model, so you can tie whatever you want to each.

To go along with it, I designed and printed a fan bracket that mounts the same way, to provide airflow to the inside of the enclosure. I've uploaded this, but I need to wait until my account is 24 hours old before publishing it.

If anyone is interested, I will be making these available on Thingiverse for download. I will be tagging anything I upload to Thingiverse with "reef-pi," and anyone else who does the same might want to consider doing this with anything they design and upload. It will make it easier to refer people to the site to see what is available and allow them to decide what will make their build easier.

I just have to do a final print of the plug panel and I will upload it.

Hope these will be of help to someone once they're published.
 
Last edited:
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,058
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
I have cut reef-pi 1.0 release yesterday night. I'll be doing some extensive testing of all the modules in next couple of days, and if I dont find any bugs (or any of you report anything), this release candidate will be the final 1.0 public release. Following are the changes that went in:
  • Dashboard now shows relevant charts only. e.g. temperature equipment usage chart is not shown when temperature control is disabled. Similar fixes for dashboard across ATO and other module specific charts. I was not sure if I want to fix this before 1.0, since this required some code changes... but I was not happy to ship 1.0 release with known UX glitches. Particularly when rest everything is working as expected
  • The equipment tab now shows only single button equipment on/off UI
  • reef-pi will now sync all outlets to their last known/expected state upon every startup. This was a bug reported by @Ryan115
  • reef-pi web interface by default now binds to port 80 instead of port 8080. It means, you can just type raspberry pi's IP without any port number and it should work
  • All UI tabs have been updated to not show elements that are not relevant. e.g. temperature alert UI was shown even when temperature control is disabled. Fixes across telemetry, ATO, temperature and other parts in the UI went in to make things more intuitive.
  • A nasty bug, that allowed sub system to load even when their dependencies are not met used to cause reef-pi to crash, has now been fixed. e.g. it was possible to enable temperature or ato or timer sub-system without equipment subsystem. reef-pi now will check for dependencies of each sub-system and disable them if not met, instead of crashing. This was not encountered by any user, since its a very rare codepath, but the risk was high (since it crashed reef-pi and repeated restart wont fix it).
Builds can be found in the usual place: https://github.com/reef-pi/reef-pi/releases/tag/1.0

I am finishing up the documentation work. Most of it is done already, couple of guides (namely 'ATO' and 'Temperature' build guide) need some more love.. which I hope to get done in next couple of days.
As usual, any testing & feedback on reef-pi software or the docs will be very helpful
Happy reefing :)
 

dburg30

Community Member
View Badges
Joined
Oct 22, 2017
Messages
56
Reaction score
93
Rating - 0%
0   0   0
If I want a different port, ie: maybe running more than 1 reef-pi, do you just change the port on the setting page, address line?
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,058
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
If I want a different port, ie: maybe running more than 1 reef-pi, do you just change the port on the setting page, address line?
You have to specify a different database file as well. Its is specified in the configuration file (/etc/reef-pi/config.yml). So, each reef-pi needs to be configured with a separate port, and invoked with separate config file that has different database path
Config file example (say reef-pi-1.yml):
Code:
---
database: "/var/lib/reef-pi/reef-pi-1.db"


Invoke a separate reef-pi
Code:
/usr/bin/reef-pi -config reef-pi-1.yml
Make sure you change the port number of any existing reef-pi installation from settings tab before starting a new one, else the new binary will try to bind to same port and block.

reef-pi debian packages ship with a systemd unit file, you can modify that and have multiple reef-pi services (say reef-pi-1, reef-pi-2 etc) for convenience, https://github.com/reef-pi/reef-pi/blob/master/build/reef-pi.service

Just for curiosity, what are your trying to achieve?
 

dburg30

Community Member
View Badges
Joined
Oct 22, 2017
Messages
56
Reaction score
93
Rating - 0%
0   0   0
You have to specify a different database file as well. Its is specified in the configuration file (/etc/reef-pi/config.yml). So, each reef-pi needs to be configured with a separate port, and invoked with separate config file that has different database path
Config file example (say reef-pi-1.yml):
Code:
---
database: "/var/lib/reef-pi/reef-pi-1.db"


Invoke a separate reef-pi
Code:
/usr/bin/reef-pi -config reef-pi-1.yml
Make sure you change the port number of any existing reef-pi installation from settings tab before starting a new one, else the new binary will try to bind to same port and block.

reef-pi debian packages ship with a systemd unit file, you can modify that and have multiple reef-pi services (say reef-pi-1, reef-pi-2 etc) for convenience, https://github.com/reef-pi/reef-pi/blob/master/build/reef-pi.service

Just for curiosity, what are your trying to achieve?

This would be for 2 different tanks.. So probably 2 different pi's...
 

Creating a strong bulwark: Did you consider floor support for your reef tank?

  • I put a major focus on floor support.

    Votes: 53 42.7%
  • I put minimal focus on floor support.

    Votes: 25 20.2%
  • I put no focus on floor support.

    Votes: 42 33.9%
  • Other.

    Votes: 4 3.2%
Back
Top