Skip to content

Commit

Permalink
Merge pull request #6 from mapero/bugfix/schema
Browse files Browse the repository at this point in the history
Add Garage Door Vent button to HCPBridge cover example and fix schema
  • Loading branch information
mapero authored Jan 23, 2024
2 parents b7c98ac + f9911f7 commit 5f328b9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Gitignore settings for ESPHome
# This is an example and may include too much for your use-case.
# You can modify this file to suit your needs.
/.esphome/
/secrets.yaml
11 changes: 10 additions & 1 deletion .github/example_build_hcpbridge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ hcpbridge:
cover:
- platform: hcpbridge
name: Garage Door
id: garagedoor_cover

switch:
- platform: hcpbridge
Expand All @@ -38,4 +39,12 @@ wifi:
ssid: "My Network"
password: "My Password"

api:
api:


button:
platform: template
name: "Garage Door Vent"
on_press:
- lambda: |-
id(garagedoor_cover).on_go_to_vent();
6 changes: 3 additions & 3 deletions components/hcpbridge/cover/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import esphome.config_validation as cv
import esphome.codegen as cg
from esphome.const import (
CONF_OUTPUT_ID
CONF_ID
)

from .. import hcpbridge_ns, HCPBridge, CONF_HCPBridge_ID
Expand All @@ -13,13 +13,13 @@

CONFIG_SCHEMA = cv.All(
cover.COVER_SCHEMA.extend({
cv.GenerateID(CONF_OUTPUT_ID): cv.declare_id(HCPBridgeCover),
cv.GenerateID(): cv.declare_id(HCPBridgeCover),
cv.GenerateID(CONF_HCPBridge_ID): cv.use_id(HCPBridge),
}).extend(cv.polling_component_schema("500ms")),
)

async def to_code(config):
var = cg.new_Pvariable(config[CONF_OUTPUT_ID])
var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(var, config)
await cover.register_cover(var, config)
parent = await cg.get_variable(config[CONF_HCPBridge_ID])
Expand Down

0 comments on commit 5f328b9

Please sign in to comment.