Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pr Changes #54

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions esphome/components/mitsubishi_itp/button/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import button
from esphome.const import (
ENTITY_CATEGORY_CONFIG,
)
from esphome.core import coroutine
from ...mitsubishi_itp.climate import (
CONF_MITSUBISHI_ITP_ID,
mitsubishi_itp_ns,
MitsubishiUART,
)

CONF_FILTER_RESET_BUTTON = "filter_reset_button"

FilterResetButton = mitsubishi_itp_ns.class_(
"FilterResetButton", button.Button, cg.Component
)

BUTTONS = {
CONF_FILTER_RESET_BUTTON: button.button_schema(
FilterResetButton,
entity_category=ENTITY_CATEGORY_CONFIG,
icon="mdi:restore",
),
}

CONFIG_SCHEMA = cv.Schema(
{
cv.GenerateID(CONF_MITSUBISHI_ITP_ID): cv.use_id(MitsubishiUART),
}
).extend(
{
cv.Optional(button_designator): button_schema
for button_designator, button_schema in BUTTONS.items()
}
)


@coroutine
async def to_code(config):
muart_component = await cg.get_variable(config[CONF_MITSUBISHI_ITP_ID])

# Buttons
for button_designator, _ in BUTTONS.items():
button_conf = config[button_designator]
button_component = await button.new_button(button_conf)
await cg.register_component(button_component, button_conf)
await cg.register_parented(button_component, muart_component)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "esphome/components/button/button.h"
#include "mitsubishi_uart.h"
#include "../mitsubishi_uart.h"

namespace esphome {
namespace mitsubishi_itp {
Expand Down
Loading
Loading