Sai Prasad Goud
Sai Prasad Goud

Reputation: 199

How can i implement Percentage controller on Fan in Google home?

I had implemented Fan turn on/off feature with OnOff trait and fan modes('High', 'Medium', 'Low') with Fanspeed trait, now i want to implement percentage controller. Ex: set the fan speed to 50 percent. How can i implement this?

Upvotes: 3

Views: 150

Answers (1)

gyanendra
gyanendra

Reputation: 26

Take reference supportsFanSpeedPercent Boolean. If set to true, this device will accept commands for adjusting the speed using a percentage from 0.0 to 100.0. Defaults to false.

It seems that you have set the value for this as False or not mentioned this attribute in your capability.

Look at this sample code:

{
  "availableFanSpeeds": {
    "speeds": [{
      "speed_name": "S1",
      "speed_values": [{
        "speed_synonym": ["low", "speed 1", ... ],
        "lang": "en" } , … ]
      },
      {
      "speed_name": "S2",
      "speed_values": [{
        "speed_synonym": ["high", "speed 2", ... ],
         "lang": "en" } , … ]
      }, ...
      ],
    "ordered": true
    },
  "supportsFanSpeedPercent": true,
  "reversible": true
}

Source: https://developers.google.com/assistant/smarthome/traits/fanspeed#response-nodejs

Upvotes: 1

Related Questions