-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flow Alerts #252
base: master
Are you sure you want to change the base?
Flow Alerts #252
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good changes.
I was hoping these changes would be included in your forked repository but unfortunately they are not. Could you please include them. Also since ifttt is no longer free could you finalize the mqtt additions. |
I've now added MQTT message support and all changes are in my forked repository under the Flow-Alerts branch. MQTT Flow Alert format where "+" is the station index number:opensprinkler/station/+/alert/flow{"flow_rate":0.00,"duration":0,"alert_setpoint":0.00} |
MQTT Message format: opensprinkler/station/+/alert/flow{"flow_rate":0.00,"duration":0,"alert_setpoint":0.00}
I noticed in your current git hub Flow Alerts repository the following "comment code" "flow_gallons=0;" is missing in: `void turn_on_station(byte sid, ulong duration) {
`
|
I separated that into a separate pull request as I believe it is a bug that should be fixed even if the Flow Alerts Pull Request is not implemented. Check Pull Request #251 Added flow_gallons reset to Station Turn On In my repository, that bug fix is in the master branch. I should have created a separate branch to make it clear. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been using this code for a few months now. But made changes to send email messages.
I have been using your implementation of OpenSprinkler on a Raspberry pi for a few months now. However, the key feature I need is for an excessive flow rate beyond the threshold set point is to stop the station (zone) when this situation occurs. I have made changes to the code to send email messages for all the push notification messages instead of ifttt. I have been studying the code to determine how to add the "stop" upon flow rate error condition. Have you looked into this? |
I'm glad its working for you, that's good to hear. So, instead of using IFTTT to send emails, you are sending them directly from a web client on the Raspberry pi? That's better because IFTTT is now charging a subscription fee to use Webhooks to send emails for OpensSprinkler. I would prefer that method as well, but I am using OpenSprinkler hardware and I don't know how to add an email server on the device. I wish they would include that as a feature in the firmware. Regarding the feature to stop a running station after a flow alert: However, there is a feature in the OpenSprinkler phone app where it shows the current flow rate in the bottom status bar. This is a real-time rate that is calculated from the last 30ish seconds of water flow. That value is not tied to a specific station, so it would be more complicated to access and constantly compare it against a set point for the running station without interrupting the main logic flow. Also, you would need to think about spikes in flow rates due to initial air pockets and other fluctuations during the run. I think other manufactures like Rachio had to implement some logic to prevent shutting down stations needlessly. |
Also, can you post in your repository the changes to send emails directly from the Raspberry Pi? I'd be interested in looking at them. |
Included is my main.ccp and a shell script that actually sends the mail message. The shell script is activated by a cron schedule. This not the most elegant solution but it does work and never misses a message. Here are the changes I made. They are at the end of the Push Notification function just before the Logging functions. I made a tempfs folder named ostemp to store the message files. ` //char postBuffer[1500];
|
Some thoughts on how to implement a stop station on excessive water flow.
The 4 minutes could be less but the lower the number the more chance of a false alarm. |
One other thing to realize is that the running flow count in the app is not accurate as a result of several delays in the do_loop causing miss counts in the flow_poll routine when the app in connected. I have done extensive testing on this and found that the running flow count is not very useful when the app is running and the flow rate is around greater than 4hz. During my station run time the flow sensor frequency ranges from 7 to 15hz. |
Are you going to merge your code with the new 2.2.1 release?
…________________________________
From: bb09961 ***@***.***>
Sent: Sunday, June 23, 2024 9:50 AM
To: OpenSprinkler/OpenSprinkler-Firmware ***@***.***>
Cc: booboodoguy ***@***.***>; Comment ***@***.***>
Subject: Re: [OpenSprinkler/OpenSprinkler-Firmware] Flow Alerts (PR #252)
Also, can you post in your repository the changes to send emails directly from the Raspberry Pi? I'd be interested in looking at them.
—
Reply to this email directly, view it on GitHub<#252 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BGOLW6WRSWK6H6KUP3CCPODZI3OEHAVCNFSM6AAAAAA5GZ55RGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBVGAZDAMZQHA>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Yes, once the new android app version is released, I'll dig into the firmware code and start testing the Flow Alerts. I may need to make additional changes in order to incorporate the new Email Notifications. On a side note, I'm not sure why Issue #248 and corresponding pull request #251 wasn't incorporated into the new firmware. |
Sorry we didn't have time to get this merged into firmware 2.2.1(0) but I will take a look at this for the next release. There are a lot of testing we had to do before releasing a firmware. We have to test it for AVR, ESP8266, Linux, Raspberry Pi, and in fact for Raspberry Pi itself we have to test it under all the cross combinations of hardware (Rpi 0, 4, 5) and Raspbian version (Bullseye, Bookworm) etc. So some PRs will take longer to review. Sorry about that, but it's on our list so it won't be missed. |
I totally understand. Looks like you guys had lots of stuff to test and I'm really glad you were able to add in email notifications. That was a bigger priority for me as well. I didn't see any comments acknowledging issue #248, so I thought the bug and PR was overlooked. I'm glad to hear it's still on the list to be considered. Thanks again. |
Bb09961 I wonder if the new email implementation will be able to handle the three successive messages that occur when a station off happens in your flow alert fork. I had to queue the messages and email them out asynchronously.
PUSH NOTIFICATION FUNCTIONS
case NOTIFY_STATION_OFF:
case NOTIFY_FLOW_ALERT:
case NOTIFY_FLOWSENSOR:
…________________________________
From: bb09961 ***@***.***>
Sent: Saturday, July 27, 2024 6:28 PM
To: OpenSprinkler/OpenSprinkler-Firmware ***@***.***>
Cc: booboodoguy ***@***.***>; Comment ***@***.***>
Subject: Re: [OpenSprinkler/OpenSprinkler-Firmware] Flow Alerts (PR #252)
I totally understand. Looks like you guys had lots of stuff to test and I'm really glad you were able to add in email notifications. That was a bigger priority for me as well.
I didn't see any comments acknowledging issue #248<#248>, so I thought the bug and PR was overlooked. I'm glad to hear it's still on the list to be considered.
Thanks again.
—
Reply to this email directly, view it on GitHub<#252 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BGOLW6UISFWUL4PWQV7TBMTZOQUKTAVCNFSM6AAAAAA5GZ55RGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJUGI4DCMJZGQ>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Good point, I'll test that out. I don't think I tested all 3 notifications enabled with IFTTT email either. |
It should be relatively easy to implement a simple email query to consolidate multiple messages into one email. Is there any reason to have IFTTT and email on both at the same time? The main purpose of email notification is to address the issue that IFTTT requires paid subscription now. If you already have IFTTT enabled, I don't see why you want to enable email as well separately. |
No, I will not use IFTTT and the new Email feature at the same time. I quit using IFTTT and started using MQTT when they started charging for webhooks. But now that email notifications have been added to OpenSprinkler, I intend to switch over to that instead as it will simplify my setup. My comment before was saying I haven't tested how each of the following alert methods will behave with multiple quick alerts triggered in succession: I'll test each method individually and report back what I observe. |
I've merged my pull request with the latest firmware. The flow alerts can now be sent via Email, IFTTT or MQTT. Also, I tested thee notifications types with all of three sending methods turned on at once and they were sent with no problems. All three of these were sent: using these three methods at the same time: |
Did you test using the email system on a raspberry pi? If so what was the OS running on the pi? |
No sorry. I only can test on the open sprikler 3.0 hardware.
|
What email service provider did you test the email performance on. I wonder if the email service will effect the probability of missing an email message. |
I'm currently using gmail. I tested it again today with the notifications enabled plus MQTT and I received all three email alerts within 15 seconds. Wed, 14 Aug 2024 12:24:38 |
Hi, I merged this pull request to the OpenSprinklerShop firmware and also added the "flow alerts" option to the notification options. |
This code change adds optional Flow Alerts to the OpenSprinkler firmware with no required code changes to the OpenSprinkler UI.
Flow Alerts will be sent via Email, IFTTT or through an MQTT message after a station run is complete if the flow rate exceeds a station's set point.
The station flow rate is calculated by pre-existing firmware logic that divides total volume by total duration in minutes after a station runs for 2.5 minutes or longer.
A station's flow rate set point must be stored as a suffix to the station's name.
**** Station Flow Rates and Flow Rate Alerts are meant for sequential stations ONLY.
**** Station Flow Rates and Flow Rate Alerts will not work for stations running in parallel.
**** Station Flow Rates and Flow Rate Alerts WILL work correctly with stations that are tied to a Master Station controlling a master valve or pump.
Steps to Enable Flow Alerts:
-- Email notifications are enabled, an IFTTT key is found or MQTT is enabled
-- a flow meter is configured
-- a valid numerical set point is found at the END of the station name
Testing Flow Alerts:
Leak Detection:
-- Configure an unused\non-wired station with a set point of 0.000
-- Run the station once a day for 1 hour. If any flow is detected an alert will be sent.
.
Example of station name with Flow Alert Set Point suffix:
.
Example of Flow Alert Email Notification:
.
Example of Flow Alert through IFTTT Email:
.
.
Example of Flow Alert MQTT Message format where "+" is the station index number:
opensprinkler/station/+/alert/flow{"flow_rate":5.00,"duration":60,"alert_setpoint":1.00}