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

V1.1.0 #60

Merged
merged 46 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
14044f4
Merge pull request #48 from rfverbruggen/master
rfverbruggen Oct 10, 2020
abb49ae
Set the next dev version number: 1.0.4-dev
rfverbruggen Oct 10, 2020
0f6f6b9
Include python 3.9 in tests
rfverbruggen Oct 13, 2020
fb0ed5d
Use a static python version when linting
rfverbruggen Oct 13, 2020
f019fe6
Fix lint.yml indent
rfverbruggen Oct 13, 2020
82931fd
Update index.rst
rfverbruggen Oct 13, 2020
bdcc15e
Merge pull request #51 from rfverbruggen/fix-docs-example
rfverbruggen Dec 3, 2020
a93898b
Merge branch 'dev' into support-python-3.9
rfverbruggen Dec 3, 2020
6d90b62
Merge pull request #50 from rfverbruggen/support-python-3.9
rfverbruggen Dec 3, 2020
9f66c72
Include codeql-analysis
rfverbruggen Jul 13, 2021
3a0bed6
style: fixing some code smells
rfverbruggen Jan 20, 2022
ada710b
style: fixing some code smells
rfverbruggen Jan 20, 2022
7472475
Merge branch 'dev' into codeql-analysis
rfverbruggen Jan 20, 2022
cd366d8
test: added codeql-analysis
rfverbruggen Jan 20, 2022
e37f624
Update tox.ini
brg468 Nov 22, 2023
6aa84b3
Update test.yml
brg468 Nov 22, 2023
39b98c9
add valve support
brg468 Dec 10, 2023
5a5cb34
fix program string
brg468 Dec 10, 2023
b89cd3b
roll back to what worked
brg468 Dec 10, 2023
02234d1
remove python 3.6
brg468 Dec 15, 2023
ef14292
try to make black happy
brg468 Dec 17, 2023
7d0e46c
build: update supported python versions
rfverbruggen Dec 30, 2023
de12e79
build: quote python test versions
rfverbruggen Dec 30, 2023
b0349b4
build: update supported python versions
rfverbruggen Dec 30, 2023
d49c8e9
Merge branch 'dev' into valve-support
rfverbruggen Dec 30, 2023
cf01859
chore: readd removed blank line
rfverbruggen Dec 30, 2023
6ace17e
docs: add all-contributors config
rfverbruggen Dec 30, 2023
6995d43
docs: add all-contributors config
rfverbruggen Dec 30, 2023
369d4d6
Merge branch 'dev' into feature-contributors
rfverbruggen Dec 30, 2023
ee8e882
docs: add all-contributors config
rfverbruggen Dec 30, 2023
e830e97
docs: update README.md [skip ci]
allcontributors[bot] Dec 30, 2023
163b423
docs: create .all-contributorsrc [skip ci]
allcontributors[bot] Dec 30, 2023
0adc64d
Merge pull request #59 from rfverbruggen/all-contributors/add-brg468
rfverbruggen Dec 30, 2023
c92fd1d
Merge branch 'dev' into valve-support
rfverbruggen Dec 30, 2023
04562d3
update tests
brg468 Dec 30, 2023
a4682aa
Merge pull request #55 from brg468/valve-support
rfverbruggen Jan 2, 2024
31241ec
Update publish.yml
rfverbruggen Jan 2, 2024
4576f07
Update publish_test.yml
rfverbruggen Jan 2, 2024
a9f6452
Update publish_test.yml
rfverbruggen Jan 3, 2024
4ab2523
Update setup.cfg
rfverbruggen Jan 3, 2024
a18f6ae
Update setup.py
rfverbruggen Jan 3, 2024
e5a047c
Delete setup.cfg
rfverbruggen Jan 3, 2024
ab3eed2
Update setup.py
rfverbruggen Jan 3, 2024
21005da
Update publish.yml
rfverbruggen Jan 3, 2024
c4015f9
Update setup.py with new version number
rfverbruggen Jan 3, 2024
915d62a
Update setup.py version number
rfverbruggen Jan 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"files": [
"README.md"
],
"imageSize": 100,
"commit": false,
"commitType": "docs",
"commitConvention": "angular",
"contributors": [
{
"login": "brg468",
"name": "Brian Rogers",
"avatar_url": "https://avatars.githubusercontent.com/u/19143191?v=4",
"profile": "https://github.com/brg468",
"contributions": [
"code",
"doc",
"test"
]
}
],
"contributorsPerLine": 7,
"skipCi": true,
"repoType": "github",
"repoHost": "https://github.com",
"projectName": "rachiopy",
"projectOwner": "rfverbruggen"
}
4 changes: 4 additions & 0 deletions .all-contributorsrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"projectName": "rachiopy",
"projectOwner": "rfverbruggen"
}
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ dev, master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ dev ]
schedule:
- cron: '28 6 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
10 changes: 3 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ jobs:
# The type of runner that the job will run on
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.6, 3.7, 3.8]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -28,4 +24,4 @@ jobs:
- name: Run flake8
run: flake8
- name: Run pydocstyle
run: pydocstyle {posargs:rachiopy tests}
run: pydocstyle {posargs:rachiopy tests}
22 changes: 12 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ on:
jobs:
build-n-publish:
name: Build and publish Python distributions to PyPI
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/RachioPy
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@master
- name: Set up Python 3.8
uses: actions/setup-python@v1
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
Expand All @@ -25,12 +30,9 @@ jobs:
run: python setup.py sdist bdist_wheel
- name: Publish distribution to Test PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}
uses: pypa/gh-action-pypi-publish@release/v1
20 changes: 12 additions & 8 deletions .github/workflows/publish_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ on:
jobs:
build-n-publish:
name: Build and publish Python distributions to Test PyPI
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
environment:
name: pypi
url: https://test.pypi.org/project/RachioPy
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@master
- name: Set up Python 3.8
uses: actions/setup-python@v1
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
Expand All @@ -24,8 +29,7 @@ jobs:
run: python -m unittest discover -v tests
- name: Build distribution
run: python setup.py sdist bdist_wheel
- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@master
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -24,4 +24,4 @@ jobs:
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements_test.txt ]; then pip install -r requirements_test.txt; fi
- name: Run unittests
run: python -m unittest discover -v tests
run: python -m unittest discover -v tests
36 changes: 32 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
Rachiopy
========
# Rachiopy
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

This python package provides a interface to the Rachio public API.

Usage
-----
## Usage

```python
from rachiopy import Rachio

Expand All @@ -13,3 +16,28 @@ r.person.info()
```

For the complete documentation visit [read the docs](https://rachiopy.readthedocs.io/en/latest/).

## Contributors

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/brg468"><img src="https://avatars.githubusercontent.com/u/19143191?v=4?s=100" width="100px;" alt="Brian Rogers"/><br /><sub><b>Brian Rogers</b></sub></a><br /><a href="https://github.com/rfverbruggen/rachiopy/commits?author=brg468" title="Code">💻</a> <a href="https://github.com/rfverbruggen/rachiopy/commits?author=brg468" title="Documentation">📖</a> <a href="https://github.com/rfverbruggen/rachiopy/commits?author=brg468" title="Tests">⚠️</a></td>
</tr>
</tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Getting Started
from rachiopy import Rachio

r = Rachio("8e600a4c-0027-4a9a-9bda-dc8d5c90350d")
resp, content = r.person.getInfo()
resp, content = r.person.info()

print (resp["status"])
print (content["id"])
Expand Down
7 changes: 7 additions & 0 deletions rachiopy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
from rachiopy.notification import Notification
from rachiopy.schedulerule import Schedulerule
from rachiopy.zone import Zone
from rachiopy.valve import Valve
from rachiopy.summary import SummaryServce
from rachiopy.program import Program


class Rachio(RachioObject):
"""Object representing the Rachio API."""

# pylint: disable=too-many-instance-attributes
def __init__(self, authtoken: str):
"""Initialze the Rachio API wrapper.

Expand All @@ -25,3 +29,6 @@ def __init__(self, authtoken: str):
self.notification = Notification(authtoken)
self.schedulerule = Schedulerule(authtoken)
self.zone = Zone(authtoken)
self.valve = Valve(authtoken)
self.summary = SummaryServce(authtoken)
self.program = Program(authtoken)
86 changes: 86 additions & 0 deletions rachiopy/program.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
"""Program module for the smart hose timer."""

from rachiopy.rachioobject import RachioObject


class Program(RachioObject):
"""Program class for the smart hose timer."""

def list_programs(self, valve_id: str):
"""Retreive the list of programs (schedules) for a valve.

For more info of the content in the response see:
https://rachio.readme.io/docs/programservice_listprograms

:param valve_id: Valve's unique id
:type valve_id: str

:return: The return value is a tuple of (response, content), the first
being and instance of the httplib2.Response class, the second
being a string that contains the response entity body.
:rtype: tuple
"""
path = f"program/listPrograms/{valve_id}"
return self.valve_get_request(path)

def get_program(self, program_id: str):
"""Retreive the information for a specific program.

For more info of the content in the response see:
https://rachio.readme.io/docs/programservice_getprogram

:param program_id: Program's unique id
:type program_id: str

:return: The return value is a tuple of (response, content), the first
being and instance of the httplib2.Response class, the second
being a string that contains the response entity body (Python
object if it contains JSON).
:rtype: tuple
"""
path = f"program/getProgram/{program_id}"
return self.valve_get_request(path)

def create_skip_overrides(self, program_id: str, timestamp: str):
"""Create manual skips for the specific program run time.
You can retrieve the runtimes from SummaryService.getValveDayViews

For more info of the content in the response see:
https://rachio.readme.io/docs/programservice_createskipoverrides

:param program_id: Program's unique id
:type program_id: str

:param timestamp: Timestamp of the run to skip
:type timestamp: timestamp

:return: The return value is a tuple of (response, content), the first
being and instance of the httplib2.Response class, the second
being a string that contains the response entity body (Python
object if it contains JSON).
:rtype: tuple
"""
payload = {"programId": program_id, "timestamp": timestamp}
return self.valve_post_request("program/createSkipOverrides", payload)

def delete_skip_overrides(self, program_id: str, timestamp: str):
"""Cancel program skips for the specified program run time.
You can retrieve upcoming skips from SummaryService.getValveDayViews

For more info of the content in the response see:
https://rachio.readme.io/docs/programservice_deleteskipoverrides

:param program_id: Program's unique id
:type program_id: str

:param timestamp: Timestamp of the run skip to delete
:type timestamp: timestamp

:return: The return value is a tuple of (response, content), the first
being and instance of the httplib2.Response class, the second
being a string that contains the response entity body (Python
object if it contains JSON).
:rtype: tuple
"""
payload = {"programId": program_id, "timestamp": timestamp}
return self.valve_post_request("program/deleteSkipOverrides", payload)
Loading
Loading