diff --git a/CODEOWNERS b/CODEOWNERS index f5dc9a17f4..cce94d4ccb 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -104,7 +104,7 @@ esphome/components/gp8403/* @jesserockz esphome/components/gpio/* @esphome/core esphome/components/gps/* @coogle esphome/components/graph/* @synco -esphome/components/grove_i2c_motor/* @max246 +esphome/components/grove_tb6612fng/* @max246 esphome/components/growatt_solar/* @leeuwte esphome/components/haier/* @paveldn esphome/components/havells_solar/* @sourabhjaiswal diff --git a/esphome/components/grove_i2c_motor/__init__.py b/esphome/components/grove_tb6612fng/__init__.py similarity index 80% rename from esphome/components/grove_i2c_motor/__init__.py rename to esphome/components/grove_tb6612fng/__init__.py index f7888f7293..75610ce9d3 100644 --- a/esphome/components/grove_i2c_motor/__init__.py +++ b/esphome/components/grove_tb6612fng/__init__.py @@ -14,23 +14,23 @@ DEPENDENCIES = ["i2c"] CODEOWNERS = ["@max246"] -grove_i2c_motor_ns = cg.esphome_ns.namespace("grove_i2c_motor") -GROVE_TB6612FNG = grove_i2c_motor_ns.class_( +grove_tb6612fng_ns = cg.esphome_ns.namespace("grove_tb6612fng") +GROVE_TB6612FNG = grove_tb6612fng_ns.class_( "GroveMotorDriveTB6612FNG", cg.Component, i2c.I2CDevice ) -GROVETB6612FNGMotorRunAction = grove_i2c_motor_ns.class_( +GROVETB6612FNGMotorRunAction = grove_tb6612fng_ns.class_( "GROVETB6612FNGMotorRunAction", automation.Action ) -GROVETB6612FNGMotorBrakeAction = grove_i2c_motor_ns.class_( +GROVETB6612FNGMotorBrakeAction = grove_tb6612fng_ns.class_( "GROVETB6612FNGMotorBrakeAction", automation.Action ) -GROVETB6612FNGMotorStopAction = grove_i2c_motor_ns.class_( +GROVETB6612FNGMotorStopAction = grove_tb6612fng_ns.class_( "GROVETB6612FNGMotorStopAction", automation.Action ) -GROVETB6612FNGMotorStandbyAction = grove_i2c_motor_ns.class_( +GROVETB6612FNGMotorStandbyAction = grove_tb6612fng_ns.class_( "GROVETB6612FNGMotorStandbyAction", automation.Action ) -GROVETB6612FNGMotorNoStandbyAction = grove_i2c_motor_ns.class_( +GROVETB6612FNGMotorNoStandbyAction = grove_tb6612fng_ns.class_( "GROVETB6612FNGMotorNoStandbyAction", automation.Action ) @@ -57,7 +57,7 @@ async def to_code(config): @automation.register_action( - "grove_i2c_motor.run", + "grove_tb6612fng.run", GROVETB6612FNGMotorRunAction, cv.Schema( { @@ -68,7 +68,7 @@ async def to_code(config): } ), ) -async def grove_i2c_motor_run_to_code(config, action_id, template_arg, args): +async def grove_tb6612fng_run_to_code(config, action_id, template_arg, args): var = cg.new_Pvariable(action_id, template_arg) await cg.register_parented(var, config[CONF_ID]) @@ -83,7 +83,7 @@ async def grove_i2c_motor_run_to_code(config, action_id, template_arg, args): @automation.register_action( - "grove_i2c_motor.break", + "grove_tb6612fng.break", GROVETB6612FNGMotorBrakeAction, cv.Schema( { @@ -92,7 +92,7 @@ async def grove_i2c_motor_run_to_code(config, action_id, template_arg, args): } ), ) -async def grove_i2c_motor_break_to_code(config, action_id, template_arg, args): +async def grove_tb6612fng_break_to_code(config, action_id, template_arg, args): var = cg.new_Pvariable(action_id, template_arg) await cg.register_parented(var, config[CONF_ID]) @@ -102,7 +102,7 @@ async def grove_i2c_motor_break_to_code(config, action_id, template_arg, args): @automation.register_action( - "grove_i2c_motor.stop", + "grove_tb6612fng.stop", GROVETB6612FNGMotorStopAction, cv.Schema( { @@ -111,7 +111,7 @@ async def grove_i2c_motor_break_to_code(config, action_id, template_arg, args): } ), ) -async def grove_i2c_motor_stop_to_code(config, action_id, template_arg, args): +async def grove_tb6612fng_stop_to_code(config, action_id, template_arg, args): var = cg.new_Pvariable(action_id, template_arg) await cg.register_parented(var, config[CONF_ID]) @@ -121,7 +121,7 @@ async def grove_i2c_motor_stop_to_code(config, action_id, template_arg, args): @automation.register_action( - "grove_i2c_motor.standby", + "grove_tb6612fng.standby", GROVETB6612FNGMotorStandbyAction, cv.Schema( { @@ -129,7 +129,7 @@ async def grove_i2c_motor_stop_to_code(config, action_id, template_arg, args): } ), ) -async def grove_i2c_motor_standby_to_code(config, action_id, template_arg, args): +async def grove_tb6612fng_standby_to_code(config, action_id, template_arg, args): var = cg.new_Pvariable(action_id, template_arg) await cg.register_parented(var, config[CONF_ID]) @@ -137,7 +137,7 @@ async def grove_i2c_motor_standby_to_code(config, action_id, template_arg, args) @automation.register_action( - "grove_i2c_motor.no_standby", + "grove_tb6612fng.no_standby", GROVETB6612FNGMotorNoStandbyAction, cv.Schema( { @@ -145,7 +145,7 @@ async def grove_i2c_motor_standby_to_code(config, action_id, template_arg, args) } ), ) -async def grove_i2c_motor_no_standby_to_code(config, action_id, template_arg, args): +async def grove_tb6612fng_no_standby_to_code(config, action_id, template_arg, args): var = cg.new_Pvariable(action_id, template_arg) await cg.register_parented(var, config[CONF_ID]) diff --git a/esphome/components/grove_i2c_motor/grove_i2c_motor.cpp b/esphome/components/grove_tb6612fng/grove_tb6612fng.cpp similarity index 98% rename from esphome/components/grove_i2c_motor/grove_i2c_motor.cpp rename to esphome/components/grove_tb6612fng/grove_tb6612fng.cpp index 669114aec0..621b7968a4 100644 --- a/esphome/components/grove_i2c_motor/grove_i2c_motor.cpp +++ b/esphome/components/grove_tb6612fng/grove_tb6612fng.cpp @@ -1,9 +1,9 @@ -#include "grove_i2c_motor.h" +#include "grove_tb6612fng.h" #include "esphome/core/log.h" #include "esphome/core/hal.h" namespace esphome { -namespace grove_i2c_motor { +namespace grove_tb6612fng { static const char *const TAG = "GroveMotorDriveTB6612FNG"; @@ -167,5 +167,5 @@ void GroveMotorDriveTB6612FNG::stepper_keep_run(StepperModeTypeT mode, uint16_t return; } } -} // namespace grove_i2c_motor +} // namespace grove_tb6612fng } // namespace esphome diff --git a/esphome/components/grove_i2c_motor/grove_i2c_motor.h b/esphome/components/grove_tb6612fng/grove_tb6612fng.h similarity index 99% rename from esphome/components/grove_i2c_motor/grove_i2c_motor.h rename to esphome/components/grove_tb6612fng/grove_tb6612fng.h index 8a0db77e70..ccdab6472a 100644 --- a/esphome/components/grove_i2c_motor/grove_i2c_motor.h +++ b/esphome/components/grove_tb6612fng/grove_tb6612fng.h @@ -34,7 +34,7 @@ */ namespace esphome { -namespace grove_i2c_motor { +namespace grove_tb6612fng { enum MotorChannelTypeT { MOTOR_CHA = 0, @@ -204,5 +204,5 @@ class GROVETB6612FNGMotorNoStandbyAction : public Action, public Parented void play(Ts... x) override { this->parent_->not_standby(); } }; -} // namespace grove_i2c_motor +} // namespace grove_tb6612fng } // namespace esphome diff --git a/tests/test3.1.yaml b/tests/test3.1.yaml index a003c804c9..5f1d3ff28f 100644 --- a/tests/test3.1.yaml +++ b/tests/test3.1.yaml @@ -303,7 +303,7 @@ sm2135: rgb_current: 20mA cw_current: 60mA -grove_i2c_motor: +grove_tb6612fng: id: test_motor address: 0x14 @@ -363,7 +363,7 @@ switch: optimistic: True on_turn_on: then: - - grove_i2c_motor.run: + - grove_tb6612fng.run: channel: 1 speed: 255 direction: BACKWARD