Closed ghulamsarwar123 closed 2 years ago
Hi @ghulamsarwar123
Did a quick test, Google Home does not show the speed selector in the app, however, it's possible to control via voice. Alexa shows the speed selector and works correctly. Are you using the correct device type or custom device?
Alexa:
Google Home:
I have selected the FAN Device. ON/OFF appears but speed selector is not visible. Neither its controllable from within the app nor from voice command. I am using Google Home right now. I shall try Alexa latter on.
Dear Kakopappa, any comment on the resolution of this issue. When would it be fixed?
Regards, Sarwar
Google Home: That’s the default behavior of google home app and we can’t change that. Google Home app doesn’t show the speed slider however speed / speed off can be controlled via voice commands
Hey google set the fan speed to 50 percent works.
Alexa : slider appears and works as expected. Check the above screenshots.
Can you share the Arduino sketch without the secrets and screenshot of the portal dashboard ?
On Sat, 20 Aug 2022 at 12:47 PM ghulamsarwar123 @.***> wrote:
Dear Kakopappa, any comment on the resolution of this issue. When would it be fixed?
Regards, Sarwar
— Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/283#issuecomment-1221238496, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZTGQCJMN5PL7T2273DV2BWPTANCNFSM57AI5XWQ . You are receiving this because you commented.Message ID: @.***>
Thank you so much for your prompt response. But I am afraid the speed is not being set by voice command even.
2 screenshot of the portal dashboard
3 voice command that doesn’t work
I will try to reproduce the issue
// we use a struct to store all states and values for our fan // fanSpeed (1..3) struct { bool powerState = false; int fanSpeed = 1; } device_state;
bool onPowerState(const String &deviceId, bool &state) { Serial.printf("Fan turned %s\r\n", state?"on":"off"); device_state.powerState = state; return true; // request handled properly }
// Fan rangeValue is from 1..3 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; }
void setupWiFi() { Serial.printf("\r\n[Wifi]: Connecting"); WiFi.begin(WIFI_SSID, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED) { Serial.printf("."); delay(250); } Serial.printf("connected!\r\n[WiFi]: IP-Address is %s\r\n", WiFi.localIP().toString().c_str()); }
void setupSinricPro() { SinricProFanUS &myFan = SinricPro[FAN_ID];
// set callback function to device myFan.onPowerState(onPowerState); myFan.onRangeValue(onRangeValue);
// setup SinricPro SinricPro.onConnected([](){ Serial.printf("Connected to SinricPro\r\n"); }); SinricPro.onDisconnected([](){ Serial.printf("Disconnected from SinricPro\r\n"); }); SinricPro.begin(APP_KEY, APP_SECRET); }
// main setup function void setup() { Serial.begin(BAUD_RATE); Serial.printf("\r\n\r\n"); setupWiFi(); setupSinricPro(); }
void loop() { SinricPro.handle(); }
The command that I pronounce for speed setting is:
Set the first fan speed to 50%
First try changing the device name to Fan not First Fan
Voice commands for Google Home:
Set the fan speed to low. Set the fan speed to high.
Demo:
https://user-images.githubusercontent.com/7474406/185744751-6d29bf44-0c76-483f-ad33-1e107a315f92.mp4
Code:
#include <Arduino.h>
#ifdef ESP8266
#include <ESP8266WiFi.h>
#endif
#ifdef ESP32
#include <WiFi.h>
#endif
#include "SinricPro.h"
#include "SinricProFanUS.h"
#define WIFI_SSID ""
#define WIFI_PASS ""
#define APP_KEY "" // Should look like "de0bxxxx-1x3x-4x3x-ax2x-5dabxxxxxxxx"
#define APP_SECRET "" // Should look like "5f36xxxx-x3x7-4x3x-xexe-e86724a9xxxx-4c4axxxx-3x3x-x5xe-x9x3-333d65xxxxxx"
#define FAN_ID "" // Should look like "5dc1564130xxxxxxxxxxxxxx"
#define BAUD_RATE 9600 // Change baudrate to your need
#define ENABLE_DEBUG
#ifdef ENABLE_DEBUG
#define DEBUG_ESP_PORT Serial
#define NODEBUG_WEBSOCKETS
#define NDEBUG
#endif
// we use a struct to store all states and values for our fan
// fanSpeed (1..3)
struct {
bool powerState = false;
int fanSpeed = 1;
} device_state;
bool onPowerState(const String &deviceId, bool &state) {
Serial.printf("Fan turned %s\r\n", state?"on":"off");
device_state.powerState = state;
return true; // request handled properly
}
// Fan rangeValue is from 1..3
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;
}
// 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\r\n", rangeValueDelta, device_state.fanSpeed);
rangeValueDelta = device_state.fanSpeed; // return absolute fan speed
return true;
}
void setupWiFi() {
Serial.printf("\r\n[Wifi]: Connecting");
WiFi.begin(WIFI_SSID, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED) {
Serial.printf(".");
delay(250);
}
Serial.printf("connected!\r\n[WiFi]: IP-Address is %s\r\n", WiFi.localIP().toString().c_str());
}
void setupSinricPro() {
SinricProFanUS &myFan = SinricPro[FAN_ID];
// set callback function to device
myFan.onPowerState(onPowerState);
myFan.onRangeValue(onRangeValue);
myFan.onAdjustRangeValue(onAdjustRangeValue);
// setup SinricPro
SinricPro.onConnected([](){ Serial.printf("Connected to SinricPro\r\n"); });
SinricPro.onDisconnected([](){ Serial.printf("Disconnected from SinricPro\r\n"); });
SinricPro.begin(APP_KEY, APP_SECRET);
}
// main setup function
void setup() {
Serial.begin(BAUD_RATE); Serial.printf("\r\n\r\n");
setupWiFi();
setupSinricPro();
}
void loop() {
SinricPro.handle();
}
I did notice a misalignment with Google Home vs Alexa which we need to fix. Alexa uses 1,2,3 system whereas Google is using percentage-based system and the SDK implementation only supports 1.2.3. we need to take a look at how to harmonize the two systems
Thanks dear but how long would it take to fix this issue, please update???
Secondly, why don't you implement 'Fan Speed' in percentage just like 'Switch with Dimming'? Why in 1. . 3? It would be perfect in % rather than in steps. I have implemented this on my hardware with a dimmer on fan which works on percentage perfectly.
Awaiting your feedback please.
Sarwar
The following already works now like in the DEMO above
Set the fan speed to low. Set the fan speed to high.
Set the fan speed to 1.3 will be fixed in the next version update along with other features and fixes. It will be released within this week or early next to production.
What about fan speed adjustment in percentage?
percentage-based fan control for Google Home will be removed so it works correctly with the current implementation and aligns with Alexa. If you want to use precentage control, you can use dimmer device type.
Yes you suggestion is right and I have already implemented 'Switch with Dimming' and it works perfectly as expected but the issue is it appears as a LIGHT BULB (LAMP) in the Google Home. The dimming control shows 'brightness'. Is there any way that I can change the Lamp with Fan and Brightness with Speed?
Thanks for your support so far.
Sarwar
Dear Kakopappa, Hope you are doing good! I am still awaiting your reply.
Thanks
Is there any way that I can change the Lamp with Fan and Brightness with Speed?
Not possible
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!
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!
Dear Sinric Team, The 'Fan Device' configured in SinricPro Portal shows the ON/OFF state of fans but the Speed Control & Feedback appears neither on Google Home or Amazon Alexa mobile apps nor gets controlled through voice commands.
Need support please.
G. Sarwar