Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
klimofey committed Jul 30, 2024
2 parents 81941e5 + 463cdd4 commit 2ccca6c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
1 change: 0 additions & 1 deletion codes/climate/1948.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"RC-3"
],
"supportedController": "UFOR11",
"disable_sending_commands_when_device_off": true,
"commandsEncoding": "Raw",
"temperatureUnit": "C",
"minTemperature": 16.0,
Expand Down
13 changes: 11 additions & 2 deletions custom_components/smartir/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
import hashlib
import json

from .controller_const import CONTROLLER_SUPPORT
from .controller_const import (
CONTROLLER_SUPPORT,
CONF_CODE_ON_NAME,
CONF_CODE_REGULAR_NAME,
)

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -442,7 +446,12 @@ def check_file_climate_commands(
return False
elif level == "temperature":
for temp in commands.keys():
if not (isinstance(commands[temp], str) and commands[temp]):
if not (
commands[temp]
and isinstance(commands[temp], dict)
and CONF_CODE_ON_NAME in commands[temp]
and CONF_CODE_REGULAR_NAME in commands[temp]
) and not (commands[temp] and isinstance(commands[temp], str)):
_LOGGER.error(
"Invalid %s device JSON file '%s': invalid 'temperature' '%s' command value '%s'.",
device_class,
Expand Down
8 changes: 5 additions & 3 deletions custom_components/smartir/climate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import asyncio
import logging

from .controller_const import (
CONF_CODE_ON_NAME,
CONF_CODE_REGULAR_NAME,
)

import voluptuous as vol
from numbers import Number

Expand Down Expand Up @@ -51,9 +56,6 @@

PRECISION_DOUBLE = 2

CONF_CODE_ON_NAME = "on"
CONF_CODE_REGULAR_NAME = "regular"

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
vol.Optional(CONF_UNIQUE_ID): cv.string,
Expand Down
3 changes: 3 additions & 0 deletions custom_components/smartir/controller_const.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@
"ZHA_COMMAND": "zha_command",
"ZHA_COMMAND_TYPE": "zha_command_type",
}

CONF_CODE_ON_NAME = "on"
CONF_CODE_REGULAR_NAME = "regular"

0 comments on commit 2ccca6c

Please sign in to comment.