Custom Intent - Fan Speed

Hey folks,

As the username implies, I’m not a programmer. I have been trying and researching for a few days now to create a custom intent to turn on Z-wave fans with a high, medium, and low setting using the voice satellite area. I think I’m close (maybe not), but I just can’t figure out how to get the pieces flowing together. Any help would be greatly appreciated.

Here is what I have so far, in a file named "fan_speed_setting.yaml in /custom_sentences/en:

language: "en"
intents:
  HassFanSpeed:
    data:
      - sentences:
         - "(turn | set) [on] [the] {area} (fan | fans) (on | to) {speed}"
         - "(turn | set) [on] [the] (fan | fans) (on | to) {speed}"
        slots:
          domain: "fan"
          
lists:
  speed:
    values:
      - in: "high"
        out: "100%"
      - in: "medium"
        out: "66%"
      - in: "low"
        out: "33%"

In config.yaml I have the following intent script:

intent_script:
  HassFanSpeed:
    action:
      - service: "fan.turn_on"
        target:
          area_id: "{{area}}"
        data:
          percentage: "{{speed}}"
    speech:
      text: "Fan has been set to {{speed}} in the {{area}}."
1 Like

Please post your code as preformatted text (</> in the cogwheel toolbar). That way people can copy it to try it out.

Thanks for the tip, made necessary edits!

1 Like

Not sure why setting fan speed intent isn’t native… seems like a WTH moment…

I tried the above and get this result with assist : Received invalid slot info for HassFanSpeed

Even though the parser shows this:

intent:
  name: HassFanSpeed
slots:
  area: office
  speed: high
  domain: fan
details:
  area:
    name: area
    value: Office
    text: office
  speed:
    name: speed
    value: 100%
    text: high
  domain:
    name: domain
    value: fan
    text: ''
targets:
  fan.office_fan:
    matched: true
match: true
sentence_template: (turn | set) [on] [the] {area} (fan | fans) (on | to) {speed}
unmatched_slots: {}
source: custom
file: en/fan_speed_setting.yaml
1 Like