sinricpro / esp8266-esp32-sdk

Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud
https://sinric.pro
228 stars 121 forks source link

Fan Device: function onAdjustRangeValue not available on dashboard/scene #306

Closed marcoratto closed 1 year ago

marcoratto commented 1 year ago

Hi, i'm testing the Fan device and there is the following code for ESP8266:

// Fan rangeValueDelta is from -3..+3
bool onAdjustRangeValue(const String &deviceId, int& rangeValueDelta) {
  device_state.fanSpeed += rangeValueDelta;
  Serial.printf("Fan speed changed about %i to %d\n", rangeValueDelta, device_state.fanSpeed);

  rangeValueDelta = device_state.fanSpeed; // return absolute fan speed
  return true;
}

But it is not possible to use on dashboard: image

image

How can I use it ?

kakopappa commented 1 year ago

Hi @marcoratto

When you set the level from the portal or app, it will call onRangeValue not onAdjustRangeValue. It will call onAdjustRangeValue when you ask Alexa to reduce the Fan speed ect..

bool onRangeValue(const String &deviceId, int& rangeValue) {
  device_state.fanSpeed = rangeValue;
  Serial.printf("Fan speed changed to %d\r\n", device_state.fanSpeed);
  return true;
}

https://github.com/sinricpro/esp8266-esp32-sdk/blob/master/examples/Fan/Fan.ino#L53

Same for scene as well.

image

stale[bot] commented 1 year ago

This issue has gone quiet. Spooky quiet. We currently close issues after 14 days of inactivity. It’s been at least 7 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder, the best way to fix this or any other problem is to provide a detailed error description including a serial log. Thanks for being a part of the SinricPro community!

stale[bot] commented 1 year ago

Hey again! It’s been 14 days since anything happened on this issue, so our friendly robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to comment on this issue or create a new one if you need anything else. As a friendly reminder, the best way to fix this or any other problem is to provide a detailed error description including a serial log. Thanks again for being a part of the SinricPro community!