Housecleaning: Use walrus operator in lock (#6554)

Co-authored-by: Keith Burzinski <kbx81x@gmail.com>
This commit is contained in:
Jesse Hills 2024-04-18 09:43:11 +12:00 committed by GitHub
parent c8cdb30459
commit 72c1c3f091
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -57,8 +57,8 @@ async def setup_lock_core_(var, config):
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
await automation.build_automation(trigger, [], conf)
if CONF_MQTT_ID in config:
mqtt_ = cg.new_Pvariable(config[CONF_MQTT_ID], var)
if mqtt_id := config.get(CONF_MQTT_ID):
mqtt_ = cg.new_Pvariable(mqtt_id, var)
await mqtt.register_mqtt_component(mqtt_, config)