mirror of
https://github.com/fmtr/haco.git
synced 2026-10-26 02:48:54 -04:00
Rename default capability name from state to default
This commit is contained in:
parent
988a3f9f4f
commit
85638bc339
5 changed files with 11 additions and 8 deletions
|
|
@ -1,4 +1,4 @@
|
|||
from haco import schema
|
||||
from haco import schema, constants
|
||||
from haco.control import Control
|
||||
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ class Button(Control):
|
|||
return schema.Schema(
|
||||
capabilities=[
|
||||
schema.Capability(
|
||||
name='state',
|
||||
name=constants.DEFAULT,
|
||||
ha=schema.HomeAssistant(announce_data=schema.AnnounceTopic(key='{io_ha}_topic')),
|
||||
tamota=None
|
||||
)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ CHARS_ALLOWED = string.ascii_lowercase + string.digits
|
|||
SEPS = '_- /'
|
||||
BRANCH = 'release'
|
||||
|
||||
DEFAULT = 'default'
|
||||
|
||||
CONFIGS_PATH = Path(os.environ['HACO_CONFIGS_PATH'])
|
||||
OPTIONS_PATH = Path(os.environ['HACO_OPTIONS_PATH'])
|
||||
MQTT_PASSWORD = os.environ['MQTT_PASSWORD']
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import logging
|
||||
from functools import partial
|
||||
|
||||
from haco import schema, tools
|
||||
from haco import schema, tools, constants
|
||||
from haco.callback import Callback
|
||||
from haco.schema import Schema, Platform, Tasmota, HomeAssistant, AnnounceTopic, Capability
|
||||
from haco.tools import log_publish
|
||||
|
|
@ -17,7 +17,7 @@ class Control:
|
|||
schema = Schema(
|
||||
capabilities=[
|
||||
Capability(
|
||||
name='state',
|
||||
name=constants.DEFAULT,
|
||||
ha=HomeAssistant(announce_data=AnnounceTopic(key='{io_ha}_topic')),
|
||||
tamota=Tasmota(announce_data=AnnounceTopic(key='{io_ha}_topic'))
|
||||
)
|
||||
|
|
@ -49,7 +49,7 @@ class Control:
|
|||
def add_callback(self, trigger, function):
|
||||
|
||||
if (function_name := function.__name__) in {Tasmota.PLATFORM, HomeAssistant.PLATFORM}:
|
||||
function_name = f'state_{function_name}'
|
||||
function_name = f'{constants.DEFAULT}_{function_name}'
|
||||
|
||||
callback_names = self.schema.get_callback_function_names()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from haco import schema
|
||||
from haco import schema, constants
|
||||
from haco.control import Control
|
||||
from haco.data.type_sensor import DeviceClassSensor
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ class Sensor(Control):
|
|||
return schema.Schema(
|
||||
capabilities=[
|
||||
schema.Capability(
|
||||
name='state',
|
||||
name=constants.DEFAULT,
|
||||
ha=None,
|
||||
tamota=schema.Tasmota(announce_data=schema.AnnounceTopic(key='{io_ha}_topic'))
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from haco import constants
|
||||
from haco.control import Control
|
||||
from haco.schema import Schema, Capability, AnnounceTopic, Tasmota, HomeAssistant
|
||||
|
||||
|
|
@ -10,7 +11,7 @@ class Update(Control):
|
|||
schema = Schema(
|
||||
capabilities=[
|
||||
Capability(
|
||||
name='state',
|
||||
name=constants.DEFAULT,
|
||||
ha=HomeAssistant(announce_data=AnnounceTopic(key='{io_ha}_topic')),
|
||||
tamota=Tasmota(announce_data=AnnounceTopic(key='{io_ha}_topic'))
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue