mirror of
https://github.com/fmtr/haco.git
synced 2026-10-26 19:01:51 -04:00
Implement Update control
This commit is contained in:
parent
5019f6376a
commit
30bc6f94fe
2 changed files with 43 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ from .pulldown import Select
|
|||
from .sensor import Sensor
|
||||
from .switch import Switch
|
||||
from .tasmota import Tasmota
|
||||
from .update import Update
|
||||
|
||||
__all__ = [
|
||||
"Button",
|
||||
|
|
@ -13,5 +14,6 @@ __all__ = [
|
|||
"Tasmota",
|
||||
"Number",
|
||||
"Switch",
|
||||
"Update",
|
||||
"tuya"
|
||||
]
|
||||
|
|
|
|||
41
haco/update.py
Normal file
41
haco/update.py
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
from haco.control import Control
|
||||
from haco.schema import Schema, Capability, AnnounceTopic, Tasmota, HomeAssistant
|
||||
|
||||
|
||||
class Update(Control):
|
||||
NAME = 'update'
|
||||
|
||||
@classmethod
|
||||
def get_schema(cls):
|
||||
schema = Schema(
|
||||
capabilities=[
|
||||
Capability(
|
||||
name='state',
|
||||
ha=HomeAssistant(announce_data=AnnounceTopic(key='{io_ha}_topic')),
|
||||
tamota=Tasmota(announce_data=AnnounceTopic(key='{io_ha}_topic'))
|
||||
),
|
||||
Capability(
|
||||
name='latest_version',
|
||||
ha=None,
|
||||
tamota=Tasmota(announce_data=AnnounceTopic(key='{capability}_topic'))
|
||||
)
|
||||
]
|
||||
)
|
||||
return schema
|
||||
|
||||
# def init(name, entity_id, icon, temperature_unit, temperature_range, humidity_range, modes, preset_modes, fan_modes, swing_modes, precision, callbacks)
|
||||
|
||||
def __init__(self, name=None, icon=None, release_url=None, entity_picture=None):
|
||||
self.release_url = release_url
|
||||
self.entity_picture = entity_picture
|
||||
|
||||
super().__init__(name, icon=icon)
|
||||
|
||||
def get_config_ha_ex(self):
|
||||
data = {
|
||||
'entity_picture': self.entity_picture,
|
||||
'payload_install': 'INSTALL',
|
||||
'release_url': self.release_url
|
||||
}
|
||||
|
||||
return data
|
||||
Loading…
Add table
Add a link
Reference in a new issue