Improve GitHub Actions (#97)

* Delete hassfest.yaml

* Update and rename ci.yaml to tox.yaml

* Create combined.yaml

* Update hacs.json

* Update README.md

* Update combined.yaml

* Remove unused import

* Restored wrongly deleted line in cover.py

* Update config_flow.py

* Update __init__.py

Co-authored-by: Pierre Ståhl <pierre.staahl@gmail.com>
Co-authored-by: rospogrigio <49229287+rospogrigio@users.noreply.github.com>
This commit is contained in:
Kendell R
2020-10-22 02:43:47 -07:00
committed by GitHub
parent c6de437e86
commit c1878f82e2
16 changed files with 76 additions and 77 deletions

26
.github/workflows/combined.yaml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: "Validation And Formatting"
on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Download repo
with:
fetch-depth: 0
- uses: actions/setup-python@v2
name: Setup Python
- uses: actions/cache@v2
name: Cache
with:
path: |
~/.cache/pip
key: custom-component-ci
- uses: KTibow/ha-blueprint@stable
name: CI
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,14 +0,0 @@
name: Validate with hassfest
on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"
jobs:
validate:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: home-assistant/actions/hassfest@master

View File

@@ -1,4 +1,4 @@
name: CI name: Tox PR CI
on: [pull_request] on: [pull_request]
@@ -11,7 +11,6 @@ jobs:
runs-on: ${{ matrix.platform }} runs-on: ${{ matrix.platform }}
strategy: strategy:
matrix: matrix:
# https://help.github.com/articles/virtual-environments-for-github-actions
platform: platform:
- ubuntu-latest - ubuntu-latest
python-version: python-version:

View File

@@ -1,6 +1,7 @@
![logo](https://github.com/rospogrigio/localtuya-homeassistant/blob/master/img/logo-small.png) ![logo](https://github.com/rospogrigio/localtuya-homeassistant/blob/master/img/logo-small.png)
A Home Assistant custom Integration for local handling of Tuya-based devices. A Home Assistant custom Integration for local handling of Tuya-based devices.
Device status is updated receiving push updates from the device instead of polling, so status updates are extremely fast (even if manually operated). Device status is updated receiving push updates from the device instead of polling, so status updates are extremely fast (even if manually operated).
The following Tuya device types are currently supported: The following Tuya device types are currently supported:

View File

@@ -58,20 +58,20 @@ import asyncio
import logging import logging
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.const import ( from homeassistant.const import (
CONF_DEVICE_ID, CONF_DEVICE_ID,
CONF_PLATFORM,
CONF_ENTITIES, CONF_ENTITIES,
CONF_HOST, CONF_HOST,
CONF_PLATFORM,
EVENT_HOMEASSISTANT_STOP, EVENT_HOMEASSISTANT_STOP,
SERVICE_RELOAD, SERVICE_RELOAD,
) )
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.reload import async_integration_yaml_config from homeassistant.helpers.reload import async_integration_yaml_config
from .const import DATA_DISCOVERY, DOMAIN, TUYA_DEVICE
from .config_flow import config_schema
from .common import TuyaDevice from .common import TuyaDevice
from .config_flow import config_schema
from .const import DATA_DISCOVERY, DOMAIN, TUYA_DEVICE
from .discovery import TuyaDiscovery from .discovery import TuyaDiscovery
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@@ -3,10 +3,9 @@ import logging
from functools import partial from functools import partial
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DOMAIN,
DEVICE_CLASSES_SCHEMA, DEVICE_CLASSES_SCHEMA,
DOMAIN,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.const import CONF_DEVICE_CLASS from homeassistant.const import CONF_DEVICE_CLASS

View File

@@ -3,21 +3,20 @@ import asyncio
import logging import logging
from random import randrange from random import randrange
from homeassistant.const import (
CONF_DEVICE_ID,
CONF_ENTITIES,
CONF_FRIENDLY_NAME,
CONF_HOST,
CONF_ID,
CONF_PLATFORM,
)
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.dispatcher import ( from homeassistant.helpers.dispatcher import (
async_dispatcher_connect, async_dispatcher_connect,
async_dispatcher_send, async_dispatcher_send,
) )
from homeassistant.helpers.entity import Entity
from homeassistant.const import (
CONF_DEVICE_ID,
CONF_ID,
CONF_FRIENDLY_NAME,
CONF_HOST,
CONF_PLATFORM,
CONF_ENTITIES,
)
from . import pytuya from . import pytuya
from .const import CONF_LOCAL_KEY, CONF_PROTOCOL_VERSION, DOMAIN, TUYA_DEVICE from .const import CONF_LOCAL_KEY, CONF_PROTOCOL_VERSION, DOMAIN, TUYA_DEVICE

View File

@@ -2,25 +2,24 @@
import logging import logging
from importlib import import_module from importlib import import_module
import homeassistant.helpers.config_validation as cv
import voluptuous as vol import voluptuous as vol
from homeassistant import config_entries, core, exceptions from homeassistant import config_entries, core, exceptions
from homeassistant.core import callback
from homeassistant.const import ( from homeassistant.const import (
CONF_ENTITIES,
CONF_ID,
CONF_HOST,
CONF_DEVICE_ID, CONF_DEVICE_ID,
CONF_ENTITIES,
CONF_FRIENDLY_NAME, CONF_FRIENDLY_NAME,
CONF_HOST,
CONF_ID,
CONF_PLATFORM, CONF_PLATFORM,
) )
import homeassistant.helpers.config_validation as cv from homeassistant.core import callback
from . import pytuya from . import pytuya
from .const import ( # pylint: disable=unused-import from .const import ( # pylint: disable=unused-import
CONF_DPS_STRINGS,
CONF_LOCAL_KEY, CONF_LOCAL_KEY,
CONF_PROTOCOL_VERSION, CONF_PROTOCOL_VERSION,
CONF_DPS_STRINGS,
DATA_DISCOVERY, DATA_DISCOVERY,
DOMAIN, DOMAIN,
PLATFORMS, PLATFORMS,

View File

@@ -4,26 +4,25 @@ import logging
from functools import partial from functools import partial
import voluptuous as vol import voluptuous as vol
from homeassistant.components.cover import ( from homeassistant.components.cover import (
CoverEntity, ATTR_POSITION,
DOMAIN, DOMAIN,
SUPPORT_CLOSE, SUPPORT_CLOSE,
SUPPORT_OPEN, SUPPORT_OPEN,
SUPPORT_STOP,
SUPPORT_SET_POSITION, SUPPORT_SET_POSITION,
ATTR_POSITION, SUPPORT_STOP,
CoverEntity,
) )
from .common import LocalTuyaEntity, async_setup_entry
from .const import ( from .const import (
CONF_COMMANDS_SET, CONF_COMMANDS_SET,
CONF_CURRENT_POSITION_DP, CONF_CURRENT_POSITION_DP,
CONF_SET_POSITION_DP,
CONF_POSITIONING_MODE,
CONF_POSITION_INVERTED, CONF_POSITION_INVERTED,
CONF_POSITIONING_MODE,
CONF_SET_POSITION_DP,
CONF_SPAN_TIME, CONF_SPAN_TIME,
) )
from .common import LocalTuyaEntity, async_setup_entry
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@@ -4,8 +4,8 @@ Entirely based on tuya-convert.py from tuya-convert:
https://github.com/ct-Open-Source/tuya-convert/blob/master/scripts/tuya-discovery.py https://github.com/ct-Open-Source/tuya-convert/blob/master/scripts/tuya-discovery.py
""" """
import json
import asyncio import asyncio
import json
import logging import logging
from hashlib import md5 from hashlib import md5

View File

@@ -3,14 +3,14 @@ import logging
from functools import partial from functools import partial
from homeassistant.components.fan import ( from homeassistant.components.fan import (
FanEntity,
DOMAIN, DOMAIN,
SPEED_OFF, SPEED_HIGH,
SPEED_LOW, SPEED_LOW,
SPEED_MEDIUM, SPEED_MEDIUM,
SPEED_HIGH, SPEED_OFF,
SUPPORT_SET_SPEED,
SUPPORT_OSCILLATE, SUPPORT_OSCILLATE,
SUPPORT_SET_SPEED,
FanEntity,
) )
from .common import LocalTuyaEntity, async_setup_entry from .common import LocalTuyaEntity, async_setup_entry

View File

@@ -3,20 +3,16 @@ import logging
from functools import partial from functools import partial
import voluptuous as vol import voluptuous as vol
from homeassistant.const import (
CONF_BRIGHTNESS,
CONF_COLOR_TEMP,
)
from homeassistant.components.light import ( from homeassistant.components.light import (
LightEntity,
DOMAIN,
ATTR_BRIGHTNESS, ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP, ATTR_COLOR_TEMP,
ATTR_HS_COLOR, ATTR_HS_COLOR,
DOMAIN,
SUPPORT_BRIGHTNESS, SUPPORT_BRIGHTNESS,
SUPPORT_COLOR_TEMP, SUPPORT_COLOR_TEMP,
LightEntity,
) )
from homeassistant.const import CONF_BRIGHTNESS, CONF_COLOR_TEMP
from .common import LocalTuyaEntity, async_setup_entry from .common import LocalTuyaEntity, async_setup_entry
from .const import CONF_BRIGHTNESS_LOWER, CONF_BRIGHTNESS_UPPER from .const import CONF_BRIGHTNESS_LOWER, CONF_BRIGHTNESS_UPPER

View File

@@ -37,15 +37,15 @@ Credits
import asyncio import asyncio
import base64 import base64
from hashlib import md5 import binascii
import json import json
import logging import logging
import time
import binascii
import struct import struct
import time
import weakref import weakref
from collections import namedtuple
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from collections import namedtuple
from hashlib import md5
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes

View File

@@ -3,16 +3,15 @@ import logging
from functools import partial from functools import partial
import voluptuous as vol import voluptuous as vol
from homeassistant.components.sensor import DEVICE_CLASSES, DOMAIN
from homeassistant.components.sensor import DOMAIN, DEVICE_CLASSES
from homeassistant.const import ( from homeassistant.const import (
CONF_DEVICE_CLASS, CONF_DEVICE_CLASS,
CONF_UNIT_OF_MEASUREMENT, CONF_UNIT_OF_MEASUREMENT,
STATE_UNKNOWN, STATE_UNKNOWN,
) )
from .const import CONF_SCALING
from .common import LocalTuyaEntity, async_setup_entry from .common import LocalTuyaEntity, async_setup_entry
from .const import CONF_SCALING
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@@ -3,12 +3,9 @@ import logging
from functools import partial from functools import partial
import voluptuous as vol import voluptuous as vol
from homeassistant.components.switch import DOMAIN, SwitchEntity
from homeassistant.components.switch import ( from .common import LocalTuyaEntity, async_setup_entry
SwitchEntity,
DOMAIN,
)
from .const import ( from .const import (
ATTR_CURRENT, ATTR_CURRENT,
ATTR_CURRENT_CONSUMPTION, ATTR_CURRENT_CONSUMPTION,
@@ -17,7 +14,6 @@ from .const import (
CONF_CURRENT_CONSUMPTION, CONF_CURRENT_CONSUMPTION,
CONF_VOLTAGE, CONF_VOLTAGE,
) )
from .common import LocalTuyaEntity, async_setup_entry
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@@ -1,6 +1,6 @@
{ {
"name": "localTuya", "name": "Local Tuya",
"domains": ["climate","cover", "fan", "light", "sensor", "switch"], "domains": ["climate", "cover", "fan", "light", "sensor", "switch"],
"homeassistant": "0.116.0", "homeassistant": "0.116.0",
"iot_class": ["Local Push"] "iot_class": ["Local Push"]
} }