mirror of
https://github.com/esphome/esphome.git
synced 2025-09-22 05:02:23 +01:00
Add generate home assistant config command (#208)
* Add generate home assistant config command * Lint * Lint
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import voluptuous as vol
|
||||
|
||||
from esphomeyaml.components import mqtt
|
||||
import esphomeyaml.config_validation as cv
|
||||
from esphomeyaml import automation
|
||||
from esphomeyaml.const import CONF_DEVICE_CLASS, CONF_ID, CONF_INTERNAL, CONF_INVERTED, \
|
||||
@@ -154,4 +155,14 @@ def register_binary_sensor(var, config):
|
||||
add_job(setup_binary_sensor_core_, binary_sensor_var, mqtt_var, config)
|
||||
|
||||
|
||||
def core_to_hass_config(data, config):
|
||||
ret = mqtt.build_hass_config(data, 'binary_sensor', config,
|
||||
include_state=True, include_command=False)
|
||||
if ret is None:
|
||||
return None
|
||||
if CONF_DEVICE_CLASS in config:
|
||||
ret['device_class'] = config[CONF_DEVICE_CLASS]
|
||||
return ret
|
||||
|
||||
|
||||
BUILD_FLAGS = '-DUSE_BINARY_SENSOR'
|
||||
|
Reference in New Issue
Block a user