Hi, I got yours to work with some slight modifications (and 1 piece that’s hardcoded). I have a few 3 speed fans that I can apply this to.
This is just a starting point that confirms the functionality works as configured.
In the custom sentence, I only made minor modifications to simplify until I got it working but I don’t think YOU need to change anything. I removed the % symbols but I honestly don’t know if it helped, I just assumed they’d cause issues when passed through downstream (if you look in automations/dev tools, the percentage is always just an integer never with the % symbol):
language: "en"
intents:
HassFanSpeed:
data:
- sentences:
- "(set) [the] {area} (fan) (to) {speed}"
- "(set) [the] (fan) (to) {speed}"
slots:
domain: "fan"
lists:
speed:
values:
- in: "high"
out: "100"
- in: "medium"
out: "66"
- in: "low"
out: "33"
and the intent script which I simplified until I got it working but I DID make substantive changes that you’ll have to update to make it work. This is also the part where I hardcoded the entity, just so I could confirm it works:
intent_script:
HassFanSpeed:
action:
- action: "fan.set_percentage"
target:
entity_id: fan.media_room_fan
data:
percentage: "{{speed}}"
speech:
text: "Fan has been set to {{speed}}"
Service was throwing errors in VScode for legacy syntax so I looked it up and it’s been changed to action and I also changed the service from fan.turn_on to fan.set_percentage because that’s what it looks like in automations/dev tools (you will need to change this). Changed from area id to entity id so I could hard code my fan.
I confirmed I can tell it to set media room fan to low/medium/high and it responds appropriately in action and speech. Obviously, I have my media room fan hardcoded in there for right this second but I’ve been at this a few hours already and I’m tired. Successful fan speed voice control was the goal and I’ve demonstrated that today.
What I’ll need to figure out/test:
Remove the hard coded entity and see if I can pass through the area and see if it will control the fan. If not, I need to look up how to do it (this is my first custom intent).
Figure out how to scale this for 10 speed fans. I saw some [<numeric_value_set>] that I think I should be able to pass through. I also found a range that might be useful if adapted properly:
language: "en"
intents:
SetVolume:
data:
- sentences:
- "(set|change) {media_player} volume to {volume} [percent]"
- "(set|change) [the] volume for {media_player} to {volume} [percent]"
lists:
media_player:
values:
- in: "living room"
out: "media_player.living_room"
- in: "bedroom"
out: "media_player.bedroom"
volume:
range:
from: 0
to: 100
I’ll take another crack at it tomorrow and try to fill in the gaps. I’m pleased as punch that I can at least control 1 fan speed by voice already.