mirror of
https://github.com/esphome/esphome.git
synced 2025-01-30 23:02:14 +01:00
Remove redundant name from binary_sensor constructor (#3213)
This commit is contained in:
parent
c123804294
commit
ffa19426d7
@ -22,7 +22,6 @@ from esphome.const import (
|
|||||||
CONF_STATE,
|
CONF_STATE,
|
||||||
CONF_TIMING,
|
CONF_TIMING,
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
CONF_NAME,
|
|
||||||
CONF_MQTT_ID,
|
CONF_MQTT_ID,
|
||||||
DEVICE_CLASS_EMPTY,
|
DEVICE_CLASS_EMPTY,
|
||||||
DEVICE_CLASS_BATTERY,
|
DEVICE_CLASS_BATTERY,
|
||||||
@ -443,7 +442,7 @@ async def register_binary_sensor(var, config):
|
|||||||
|
|
||||||
|
|
||||||
async def new_binary_sensor(config):
|
async def new_binary_sensor(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID], config[CONF_NAME])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
await register_binary_sensor(var, config)
|
await register_binary_sensor(var, config)
|
||||||
return var
|
return var
|
||||||
|
|
||||||
|
@ -42,8 +42,7 @@ void BinarySensor::send_state_internal(bool state, bool is_initial) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string BinarySensor::device_class() { return ""; }
|
std::string BinarySensor::device_class() { return ""; }
|
||||||
BinarySensor::BinarySensor(const std::string &name) : EntityBase(name), state(false) {}
|
BinarySensor::BinarySensor() : state(false) {}
|
||||||
BinarySensor::BinarySensor() : BinarySensor("") {}
|
|
||||||
void BinarySensor::set_device_class(const std::string &device_class) { this->device_class_ = device_class; }
|
void BinarySensor::set_device_class(const std::string &device_class) { this->device_class_ = device_class; }
|
||||||
std::string BinarySensor::get_device_class() {
|
std::string BinarySensor::get_device_class() {
|
||||||
if (this->device_class_.has_value())
|
if (this->device_class_.has_value())
|
||||||
|
@ -26,11 +26,6 @@ namespace binary_sensor {
|
|||||||
class BinarySensor : public EntityBase {
|
class BinarySensor : public EntityBase {
|
||||||
public:
|
public:
|
||||||
explicit BinarySensor();
|
explicit BinarySensor();
|
||||||
/** Construct a binary sensor with the specified name
|
|
||||||
*
|
|
||||||
* @param name Name of this binary sensor.
|
|
||||||
*/
|
|
||||||
explicit BinarySensor(const std::string &name);
|
|
||||||
|
|
||||||
/** Add a callback to be notified of state changes.
|
/** Add a callback to be notified of state changes.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user