fix: convert run_seconds float values to int before API calls#352
Merged
vinteo merged 3 commits intovinteo:masterfrom Jan 5, 2026
Merged
fix: convert run_seconds float values to int before API calls#352vinteo merged 3 commits intovinteo:masterfrom
vinteo merged 3 commits intovinteo:masterfrom
Conversation
OpenSprinkler interprets decimal points as zone separators, causing run_seconds values like [0, 480.0, 540.0] to fail. This converts all numeric values to integers before passing them to the API. Also adds pytest test suite covering the fix. Fixes vinteo#294
Owner
|
Thanks for adding tests, would it be difficult to add a github action to run the tests? |
- Add tests.yml workflow that runs pytest on push/PR - Tests against Python 3.12 and 3.13 - Clean up unused imports in test file
Contributor
Author
|
Added a GitHub Actions workflow to run the tests! It runs pytest against Python 3.12 and 3.13 on every push and PR. Also cleaned up unused imports in the test file. |
|
Owner
|
Thank you very much |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Converts float values in
run_secondsto integers before sending to the OpenSprinkler API.Problem
OpenSprinkler interprets decimal points as zone separators, so values like
[0, 480.0, 540.0]fail while[0, 480, 540]works correctly. This commonly occurs when users calculate run times using templates that produce float results.Solution
Added
int()conversion in all code paths that passrun_secondsto the API:[int(s) for s in run_seconds]Testing
Added pytest test suite with 8 tests covering:
All tests pass locally.
Fixes #294