Skip to content
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

Use configured weather adjustment when running program #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

booysenn
Copy link

@booysenn booysenn commented Jul 22, 2023

Hi,

I use the home assistant integration when you manually run a program it always defaults to not use the water level and runs all stations at 100% level.

This is due to the uwt flag hard coded to 0 in the program run code

Changing it to params = {"pid": self._index, "uwt": int(self.use_weather_adjustments)} allows it to follow what is configured in the open sprinkler program.

Fixes #79

@codecov
Copy link

codecov bot commented Jul 22, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +1.33% 🎉

Comparison is base (2dbc5dd) 69.42% compared to head (f1458e8) 70.75%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #80      +/-   ##
==========================================
+ Coverage   69.42%   70.75%   +1.33%     
==========================================
  Files           4        4              
  Lines         870      872       +2     
==========================================
+ Hits          604      617      +13     
+ Misses        266      255      -11     
Files Changed Coverage Δ
pyopensprinkler/program.py 86.09% <100.00%> (+3.39%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vinteo
Copy link
Owner

vinteo commented Jul 22, 2023

What do you think about taking it a bit further and pass it as a param to the run() function (and pass it on to _manual_run() but use use_weather_adjustments as the default if nothing is specified?

Then we can update the HA integration service to have the option to pass the flag too.

Thanks for this

@booysenn
Copy link
Author

What do you think about taking it a bit further and pass it as a param to the run() function (and pass it on to _manual_run() but use use_weather_adjustments as the default if nothing is specified?

Then we can update the HA integration service to have the option to pass the flag too.

Thanks for this

Yeah that makes sense,.

I will work on the adjustment and update the pull request. Will use a parameter called uwt with default value None on both run(self, uwt=None) and _manual_run(self, uwt=None) and make the substitution to use_weather_adjustments in _manual_run() if uwt is None there.

I see coverage is failing but not really sure how to add unit tests for these functions though

@vinteo
Copy link
Owner

vinteo commented Jul 23, 2023

for the tests, you need to run a dcoker container with the OS firmware and run the pytest against it. You can check the commands in the travis file:

https://github.com/vinteo/py-opensprinkler/blob/master/.travis.yml

@sonarcloud
Copy link

sonarcloud bot commented Sep 3, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Owner

@vinteo vinteo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just some minor linting things

Copy link

sonarcloud bot commented Sep 19, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Water level not used when running a program
2 participants