Update PIN Code
The Update PIN Code action changes the parental controls override PIN for a Nintendo Switch.
This is useful when you want an automation or script to change the PIN at a specific time or after something else happens in Home Assistant.
This action does not support targets. In the UI, you are not prompted to choose an area, entity, or label. Instead, you select the Nintendo Switch to update through the Device option.
Using this action from the user interface
If you prefer building automations and scripts visually, Home Assistant walks you through this action step by step. You pick what to target, tweak a few options, and save. No YAML knowledge required.
To update the PIN from an automation or a script:
- Go to Settings > Automations & scenes.
- Open an existing automation or script, or select Create automation > Create new automation.
- If you’re setting up a new automation, add a trigger in the When section. Scripts don’t need a trigger. They run when something else calls them.
- In the Then do section, select Add action.
- From the search box, search for and select Nintendo Switch parental controls: Update PIN code.
- Choose the Device, then enter the new PIN.
- Select Save.
Options in the UI
Using this action in YAML
If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required.
In YAML, refer to this action as nintendo_parental_controls.update_pin_code. A basic example looks like this:
action: nintendo_parental_controls.update_pin_code
data:
device_id: 1b4a46c6d0f3406c80d275f5b0c6483b
pin: "1234"
This changes the parental controls override PIN for the selected Nintendo Switch to 1234.
Options in YAML
Good to know
- The Device option must be a Nintendo Switch device from the Nintendo Switch Parental Controls integration.
- The PIN must contain only digits and be 4 to 8 digits long.
- When changing the PIN, Nintendo sends you an email automatically. Home Assistant cannot disable this email. The email does not contain the PIN.
- Entering this PIN on the Nintendo Switch bypasses all parental control restrictions.
Try it yourself
Ready to test this? Open Settings > Tools > Actions, search for this action, fill in the fields, and select Perform action. You see what happens on your actual entitiesAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more] without writing a line of YAML.
More examples
Real scenarios where this action shows up in automations and scripts. Copy any example and adapt it to your setup.
You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the automation editor in Home Assistant, and press Ctrl+V (or Cmd+V on Mac). Home Assistant automatically converts the pasted YAML into the visual editor format, whether it’s a full automation, a single trigger, a condition, or an action.
Automation: Change the PIN from a toggle helper
This automation changes the PIN when a user-created toggle helperA helper is a virtual entity you create inside Home Assistant. It is not backed by a physical device. Helpers store values, track state, or do calculations that your automations and dashboards need. [Learn more] turns on. Create this helper separately before using the example.
-
Trigger: State
- Target: Change switch pin (input boolean)
- To: On
-
Action: Nintendo Switch parental controls: Update PIN code
- Device: The Nintendo Switch to update
-
PIN:
5678
YAML example for changing the PIN from a toggle helper
alias: "Change Nintendo Switch PIN from helper"
triggers:
- trigger: state
entity_id: input_boolean.change_switch_pin
to: "on"
actions:
- action: nintendo_parental_controls.update_pin_code
data:
device_id: 1b4a46c6d0f3406c80d275f5b0c6483b
pin: "5678"
Automation: Restore the usual PIN each evening
This automation restores the usual PIN at 9:00 PM each day.
-
Trigger: Time
-
At time:
9:00:00PM
-
At time:
-
Action: Nintendo Switch parental controls: Update PIN code
- Device: The Nintendo Switch to update
-
PIN:
1234
YAML example for restoring the usual PIN each evening
alias: "Restore Nintendo Switch PIN in the evening"
triggers:
- trigger: time
at: "21:00:00"
actions:
- action: nintendo_parental_controls.update_pin_code
data:
device_id: 1b4a46c6d0f3406c80d275f5b0c6483b
pin: "1234"
Still stuck?
The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the action you’re calling and what you expected to happen, or share on our subreddit /r/homeassistant.
AI assistants like ChatGPT or Claude can also explain actions or suggest the right one when you describe what you want in plain language.