Skip to content

Commit

Permalink
Change Sensor Command code to templatable
Browse files Browse the repository at this point in the history
  • Loading branch information
AzonInc committed Jun 7, 2024
1 parent ec8b724 commit 3d7d10f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion components/tcs_intercom/binary_sensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{
cv.GenerateID(): cv.declare_id(TCSIntercomBinarySensor),
cv.GenerateID(CONF_TCS_ID): cv.use_id(TCSIntercom),
cv.Required(CONF_COMMAND): cv.hex_uint32_t,
cv.Required(CONF_COMMAND): cv.templatable(cv.hex_uint32_t),
cv.Optional(CONF_ICON, default="mdi:doorbell"): cv.icon,
cv.Optional(CONF_NAME, default="Doorbell"): cv.string,
cv.Optional(CONF_AUTO_OFF, default="3s"): cv.positive_time_period_milliseconds
Expand Down
21 changes: 21 additions & 0 deletions components/tcs_intercom/tcs_intercom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include "esphome/core/application.h"
#include <Arduino.h>

#include "esp_efuse.h"
#include "esp_efuse_table.h"

namespace esphome
{
namespace tcs_intercom
Expand All @@ -21,6 +24,24 @@ namespace esphome
{
ESP_LOGCONFIG(TAG, "Setting up TCS Intercom...");

#if defined(ESP32)
ESP_LOGD(TAG, "Check for Doorman Hardware Revision");

// Doorman Hardware Revision
uint8_t ver[3];
uint32_t value;
esp_efuse_read_block(EFUSE_BLK3, &value, 0, 24);
ver[0] = value >> 0;
ver[1] = value >> 8;
ver[2] = value >> 16;

if(ver[0] > 0)
{
ESP_LOGI(TAG, "Doorman Hardware detected: V%i.%i.%i", ver[0], ver[1], ver[2]);
}
#endif


this->rx_pin_->setup();
this->tx_pin_->setup();
this->tx_pin_->digital_write(false);
Expand Down

0 comments on commit 3d7d10f

Please sign in to comment.