I am trying to uild a electric lock for testing usage. I have an power adapter from 230 to 12V connected to an Mosfet trigger module. From the trigger module the electric lock is connected that needs 12V and connected esp to it.
switch:
- platform: gpio
id: mag_lock
name: "Lock Switch"
internal: false
pin: GPIO17
restore_mode: restore_default_on
icon: mdi:magnet
on_turn_on:- lambda: id(schacht_luke).publish_state(LOCK_STATE_LOCKED);
on_turn_off: - lambda: id(schacht_luke).publish_state(LOCK_STATE_UNLOCKED);
- lambda: id(schacht_luke).publish_state(LOCK_STATE_LOCKED);
lock:
- platform: template
name: "schacht_lucke"
id: schacht_luke
lock_action:- switch.turn_on: mag_lock
- logger.log: "Door Locked!"
unlock_action: - switch.turn_off: mag_lock
- logger.log: "Door Unlocked!"
This is my ESP code, i think it works because i can click lock or unlock and see an led on the Mostfet board toggle on/off. But the lock is not doing anything. Not sure if i did something on the wiring wrong or maybe miss something in the code. Can anyone help here?