[sprinkler][dfplayer][max6956][rf_bridge] Fix cg.templatable type mismatches (#15480)

This commit is contained in:
Jonathan Swoboda
2026-04-06 16:29:59 -04:00
committed by GitHub
parent dbd4e77d61
commit a64f09a43f
4 changed files with 15 additions and 13 deletions
+7 -7
View File
@@ -122,7 +122,7 @@ async def dfplayer_previous_to_code(config, action_id, template_arg, args):
async def dfplayer_play_mp3_to_code(config, action_id, template_arg, args):
var = cg.new_Pvariable(action_id, template_arg)
await cg.register_parented(var, config[CONF_ID])
template_ = await cg.templatable(config[CONF_FILE], args, float)
template_ = await cg.templatable(config[CONF_FILE], args, cg.uint16)
cg.add(var.set_file(template_))
return var
@@ -143,10 +143,10 @@ async def dfplayer_play_mp3_to_code(config, action_id, template_arg, args):
async def dfplayer_play_to_code(config, action_id, template_arg, args):
var = cg.new_Pvariable(action_id, template_arg)
await cg.register_parented(var, config[CONF_ID])
template_ = await cg.templatable(config[CONF_FILE], args, float)
template_ = await cg.templatable(config[CONF_FILE], args, cg.uint16)
cg.add(var.set_file(template_))
if CONF_LOOP in config:
template_ = await cg.templatable(config[CONF_LOOP], args, float)
template_ = await cg.templatable(config[CONF_LOOP], args, cg.bool_)
cg.add(var.set_loop(template_))
return var
@@ -167,13 +167,13 @@ async def dfplayer_play_to_code(config, action_id, template_arg, args):
async def dfplayer_play_folder_to_code(config, action_id, template_arg, args):
var = cg.new_Pvariable(action_id, template_arg)
await cg.register_parented(var, config[CONF_ID])
template_ = await cg.templatable(config[CONF_FOLDER], args, float)
template_ = await cg.templatable(config[CONF_FOLDER], args, cg.uint16)
cg.add(var.set_folder(template_))
if CONF_FILE in config:
template_ = await cg.templatable(config[CONF_FILE], args, float)
template_ = await cg.templatable(config[CONF_FILE], args, cg.uint16)
cg.add(var.set_file(template_))
if CONF_LOOP in config:
template_ = await cg.templatable(config[CONF_LOOP], args, float)
template_ = await cg.templatable(config[CONF_LOOP], args, cg.bool_)
cg.add(var.set_loop(template_))
return var
@@ -213,7 +213,7 @@ async def dfplayer_set_device_to_code(config, action_id, template_arg, args):
async def dfplayer_set_volume_to_code(config, action_id, template_arg, args):
var = cg.new_Pvariable(action_id, template_arg)
await cg.register_parented(var, config[CONF_ID])
template_ = await cg.templatable(config[CONF_VOLUME], args, float)
template_ = await cg.templatable(config[CONF_VOLUME], args, cg.uint8)
cg.add(var.set_volume(template_))
return var
+4 -2
View File
@@ -117,7 +117,7 @@ async def max6956_pin_to_code(config):
async def max6956_set_brightness_global_to_code(config, action_id, template_arg, args):
paren = await cg.get_variable(config[CONF_ID])
var = cg.new_Pvariable(action_id, template_arg, paren)
template_ = await cg.templatable(config[CONF_BRIGHTNESS_GLOBAL], args, float)
template_ = await cg.templatable(config[CONF_BRIGHTNESS_GLOBAL], args, cg.uint8)
cg.add(var.set_brightness_global(template_))
return var
@@ -139,6 +139,8 @@ async def max6956_set_brightness_global_to_code(config, action_id, template_arg,
async def max6956_set_brightness_mode_to_code(config, action_id, template_arg, args):
paren = await cg.get_variable(config[CONF_ID])
var = cg.new_Pvariable(action_id, template_arg, paren)
template_ = await cg.templatable(config[CONF_BRIGHTNESS_MODE], args, float)
template_ = await cg.templatable(
config[CONF_BRIGHTNESS_MODE], args, MAX6956_CURRENTMODE
)
cg.add(var.set_brightness_mode(template_))
return var
+2 -2
View File
@@ -185,9 +185,9 @@ RFBRIDGE_SEND_ADVANCED_CODE_SCHEMA = cv.Schema(
async def rf_bridge_send_advanced_code_to_code(config, action_id, template_args, args):
paren = await cg.get_variable(config[CONF_ID])
var = cg.new_Pvariable(action_id, template_args, paren)
template_ = await cg.templatable(config[CONF_LENGTH], args, cg.uint16)
template_ = await cg.templatable(config[CONF_LENGTH], args, cg.uint8)
cg.add(var.set_length(template_))
template_ = await cg.templatable(config[CONF_PROTOCOL], args, cg.uint16)
template_ = await cg.templatable(config[CONF_PROTOCOL], args, cg.uint8)
cg.add(var.set_protocol(template_))
template_ = await cg.templatable(config[CONF_CODE], args, cg.std_string)
cg.add(var.set_code(template_))
+2 -2
View File
@@ -427,7 +427,7 @@ CONFIG_SCHEMA = cv.All(
async def sprinkler_set_divider_to_code(config, action_id, template_arg, args):
paren = await cg.get_variable(config[CONF_ID])
var = cg.new_Pvariable(action_id, template_arg, paren)
template_ = await cg.templatable(config[CONF_DIVIDER], args, cg.float_)
template_ = await cg.templatable(config[CONF_DIVIDER], args, cg.uint32)
cg.add(var.set_divider(template_))
return var
@@ -471,7 +471,7 @@ async def sprinkler_set_queued_valve_to_code(config, action_id, template_arg, ar
async def sprinkler_set_repeat_to_code(config, action_id, template_arg, args):
paren = await cg.get_variable(config[CONF_ID])
var = cg.new_Pvariable(action_id, template_arg, paren)
template_ = await cg.templatable(config[CONF_REPEAT], args, cg.float_)
template_ = await cg.templatable(config[CONF_REPEAT], args, cg.uint32)
cg.add(var.set_repeat(template_))
return var