Skip to content
Merged
34 changes: 0 additions & 34 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v2
Expand Down
80 changes: 65 additions & 15 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,77 @@
# This workflow will upload a Python Package to PyPI when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-20.04
release-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine unasync
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

- name: Build release distributions
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
# NOTE: put your own distribution build steps here.
python -m pip install build
python -m build

Check failure on line 34 in .github/workflows/python-publish.yml

View workflow job for this annotation

GitHub Actions / Check YAML

[trailing-spaces] trailing spaces
- name: Upload wheel to GitHub Release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*.whl" # Path to your wheel file(s)
tag: ${{ github.ref_name }}
allowUpdates: true

- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

pypi-publish:
runs-on: ubuntu-latest
needs:
- release-build
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

# Dedicated environments with protections for publishing are strongly recommended.
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
environment:
name: pypi
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
url: https://pypi.org/project/pyhive-integration
#
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
# ALTERNATIVE: exactly, uncomment the following line instead:
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
6 changes: 5 additions & 1 deletion pyhiveapi/apyhiveapi/helper/hive_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ def getDeviceData(self, product: dict):
except KeyError:
pass
elif type == "trvcontrol":
device = self.session.data.devices[product["props"]["trvs"][0]]
trv_present = len(product["props"]["trvs"]) > 0
if trv_present:
device = self.session.data.devices[product["props"]["trvs"][0]]
else:
raise KeyError
elif type == "warmwhitelight" and product["props"]["model"] == "SIREN001":
device = self.session.data.devices[product["parent"]]
elif type == "sense":
Expand Down
29 changes: 17 additions & 12 deletions pyhiveapi/apyhiveapi/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ def addList(self, entityType: str, data: dict, **kwargs: dict):
Returns:
dict: Entity.
"""
device = self.helper.getDeviceData(data)
device_name = (
device["state"]["name"]
if device["state"]["name"] != "Receiver"
else "Heating"
)
formatted_data = {}

try:
device = self.helper.getDeviceData(data)
device_name = (
device["state"]["name"]
if device["state"]["name"] != "Receiver"
else "Heating"
)
formatted_data = {}

formatted_data = {
"hiveID": data.get("id", ""),
"hiveName": device_name,
Expand All @@ -154,11 +154,11 @@ def addList(self, entityType: str, data: dict, **kwargs: dict):
else:
formatted_data["haName"] = device_name
formatted_data.update(kwargs)
self.deviceList[entityType].append(formatted_data)
return formatted_data
except KeyError as error:
self.logger.error(error)

self.deviceList[entityType].append(formatted_data)
return formatted_data
return None

async def updateInterval(self, new_interval: timedelta):
"""Update the scan interval.
Expand Down Expand Up @@ -535,8 +535,13 @@ async def createDevices(self):
):
continue
product_list = PRODUCTS.get(self.data.products[aProduct]["type"], [])
product_name = self.data.products[aProduct]["state"].get("name", "Unknown")
for code in product_list:
eval("self." + code)
try:
eval("self." + code)
except (NameError, AttributeError) as e:
self.logger.warning(f"Device {product_name} cannot be setup - {e}")
pass

if self.data.products[aProduct]["type"] in hive_type:
self.config.mode.append(p["id"])
Expand Down
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[metadata]
name = pyhiveapi
name = pyhive-integration
description = A Python library to interface with the Hive API
keywords = Hive API Library
license = MIT
author = Rendili
author_email = rendili@outlook.com
author = KJonline24
author_email = khole_47@icloud.com
url = https://github.com/Pyhive/pyhiveapi
project_urls =
Source = https://github.com/Pyhive/Pyhiveapi
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def requirements_from_file(filename="requirements.txt"):


setup(
version="0.5.16",
version="1.0.1",
package_data={"data": ["*.json"]},
include_package_data=True,
cmdclass={
Expand Down
Loading