Integrating VS code with Home Assistant, creating voice commands

I’m new to this project, but I’ve been diving in quickly. Right now, I’m running four voice assistant modules, a Home Assistant Green with WiFi, Zigbee, and Z-Wave, plus a SmartThings hub and an Alexa setup that I’m actively working to remove.

I’ve connected my Home Assistant Green to my Mac mini Pro and set up access through VS Code using SSH. That’s been a turning point. I’m now developing voice commands using both Claude in the browser and Claude Code inside VS Code, and the workflow is surprisingly powerful.

For example, I’ve been able to identify entities and ask Claude how to configure a dimmable kitchen light so it responds to percentage-based voice commands. In just a week or two, I’ve replaced most of the verbal commands I used with Alexa. The goal is a fully self-contained home automation system that does not rely on internet connectivity.

One key thing I learned involves wall switches. My GE Enbrighten (Jasco) switches were auto-detected as “switches,” but in reality they control lights. To make everything behave correctly in automations and voice commands, they need to be treated as lights in Home Assistant.

That’s where Helpers comes in.

Go to Settings → Devices & Services → Helpers. From there, you can create a helper that exposes a switch as a light. Doing this for each wall switch makes everything more intuitive and reduces confusion when building automations. It also aligns your system more closely with how you actually think about the devices.

On the development side, using VS Code connected over SSH to Home Assistant Green has been a huge advantage. With Claude Code integrated, I can work directly against my synced Home Assistant configuration files. That means Claude has full context, which makes its responses faster, more accurate, and far more useful.

In some cases, it can even modify YAML configurations directly based on prompts.

If you like to tinker, I highly recommend setting up a development environment like this. Install VS Code, connect it to your Home Assistant instance, and let Claude work with your actual files. It turns automation development into something much more interactive and efficient.

I’ve only been at this for a couple of weeks, but with these tools in place, it finally feels like I’m on the right path, and that I can build just about anything with YAML.

alias: Voice - Nook light on
description: “”
triggers:

  • trigger: conversation
    command:
    • turn on the nook
    • nook on
    • turn the nook on
    • turn on the nook lights
    • turn on the nook light
    • nook lights on
    • turn the nook lights on
    • nook lights {brightness}
    • nook {brightness}
    • turn on the nook to {brightness}
    • nook on at {brightness}
    • set the nook to {brightness}
    • nook to {brightness}
      actions:
  • action: light.turn_on
    target:
    entity_id: light.nook_lights
    data:
    brightness_pct: >
    {% if trigger.slots is defined and trigger.slots.brightness is defined
    %}
    {{ trigger.slots.brightness | int(50) }}
    {% else %}
    80
    {% endif %}

There is a syntax for voice commandsthat you might look into. Now you have many hardcode sentences that looks quiet similair
Example

  • turn on the nook lights
  • turn on the nook light

The syntax allows you to omit parts of the sentence and use diffenent options

Turn (on|off) [the] nook light(s)

( i am doing this from memory. Actual syntax may look a bit else. You have to look them up in the HA voice docs or look at the build in voice sentences)

It’s good practice to end voice automations with the Set conversation response action. But LLM doesn’t know about this because they couldn’t find the documentation.

1 Like

I tried this suggestion to shorten the commands, but it introduced an unexpected problem. When I said “nook off,” the response was “Setting the nook lights to off percent” — the word “off” was being captured as a brightness value, bypassing my separate Nook Off automation entirely.

I prefer keeping on and off as separate automations for clarity and simpler YAML. There doesn’t appear to be a way to constrain slot matching to numeric values only in automation conversation triggers, so my solution was to go back to the explicit command list. Less elegant, but it works reliably.

I appreciaate the feedback. As I mentioned, I’, new to this project with only a few weeks into it (in my spare time).

Here’s my updated YAML code:

alias: Voice - Nook light on
description: ""
triggers:
  - trigger: conversation
    command:
      - turn on the nook
      - nook on
      - turn the nook on
      - turn on the nook light(s)
      - nook light(s) on
      - turn the nook light(s) on
      - nook light(s) {brightness}
      - nook {brightness}
      - turn on the nook to {brightness}
      - nook on at {brightness}
      - set the nook to {brightness}
      - nook to {brightness}
actions:
  - action: light.turn_on
    target:
      entity_id: light.nook_lights
    data:
      brightness_pct: >
        {% if trigger.slots is defined and trigger.slots.brightness is defined
        %}
          {{ trigger.slots.brightness | int(50) }}
        {% else %}
          80
        {% endif %}
  - set_conversation_response: |
      {% if trigger.slots is defined and trigger.slots.brightness is defined %}
        Setting nook lights to {{ trigger.slots.brightness }} percent.
      {% else %}
        Nook lights on.
      {% endif %}

This shorthand syntax introduced ambiguity and intercepted the nook off command assigned to a separate automation. This resulted in a response saying: Setting nook lights to off percent.

    command:
      - turn (on) [the] nook [light(s)]
      - nook [light(s)] on
      - nook [light(s)] {brightness}
      - turn [the] nook [light(s)] to {brightness}
      - nook on at {brightness}
      - set [the] nook [light(s)] to {brightness}

The syntax elements being used:

  • (a|b) means “a or b” – required choice
  • [word] means the word is optional
  • (s) on the end of a word makes the “s” optional, covering singular and plural

Your advice was spot on… So in VSCode integrated with HA and with Claude Code I was able to say:

"I’ve learned that automation best practices are to include conversation responses in YAML automations to define more specific voice responses compared to the default, “Done”.

What automations in my instance of Home Assistant could benefit from these more specific conversation responses?"

And then Claude identified all the automations, indicated a priority of automations to be updated based on the number of entities in each automations and scene. Then it asked me if I’d like Claude to update each automation. I told it to only update the priority automations. And presto! Claude updated 27 automations to add a uniquely relevant conversation response.