sinricpro / feature-requests

Feature request tracker for Sinric Pro
0 stars 0 forks source link

Google Home Linked Sinric pro but no device #17

Closed chongy076 closed 1 year ago

chongy076 commented 1 year ago

Hi ,

in Sincric web i can control the device (I can turn it On and Off and ESP8266 also received the msg) , but when google home add linking to Sinric in phone. It said device not found (only setup 1 device) . please add device or temporary got problem try again later. and log said " googlehome-action | Google Home action linked googlehome-action | Logged in with username and password

" no matter how many times also same.

Update: Tried on Samsung smart things linking it is working... but not google home

/*

// Uncomment the following line to enable serial debug output //#define ENABLE_DEBUG

ifdef ENABLE_DEBUG

define DEBUG_ESP_PORT Serial

define NODEBUG_WEBSOCKETS

define NDEBUG

endif

include

ifdef ESP8266

include

endif

ifdef ESP32

include

endif

include

include "SolarInverter.h"

//#include "SinricProSwitch.h"

define APP_KEY "todo"

define APP_SECRET "todo"

define DEVICE_ID "todo"

define SSID "todo"

define PASS "todo"

define BAUD_RATE 115200

ifdef ESP8266

define RELAY_PIN 2 // Pin where the relay is connected (D5 = GPIO 14 on ESP8266)

endif

SolarInverter &solarInverter = SinricPro[DEVICE_ID]; //SinricProSwitch& mySwitch = SinricPro[DEVICE_ID]; // create new switch device /*****

// ToggleController std::map<String, bool> globalToggleStates;

/*****

// ToggleController bool onToggleState(const String& deviceId, const String& instance, bool &state) { Serial.printf("[Device: %s]: State for \"%s\" set to %s\r\n", deviceId.c_str(), instance.c_str(), state ? "on" : "off"); globalToggleStates[instance] = state; return true; }

/**

// ToggleController void updateToggleState(String instance, bool state) { digitalWrite(RELAY_PIN, state); // set pin state

Serial.printf("[Update Device:]: State for \"%s\" set to %s\r\n", instance.c_str(), state ? "on" : "off"); solarInverter.sendToggleStateEvent(instance, state); }

/bool onPowerState(const String &deviceId, bool &state) { digitalWrite(RELAY_PIN, state); // set pin state Serial.printf("[Power Device:%s]: State set to %s\r\n", deviceId.c_str(), state ? "on" : "off"); return true; // request handled properly }/ /*****

void setupSinricPro() { pinMode(RELAY_PIN, OUTPUT); // set relay-pin to output mode

// ToggleController //mySwitch.onPowerState(onPowerState); // apply onPowerState callback solarInverter.onToggleState("toggleInstance1", onToggleState);

SinricPro.onConnected([]{ Serial.printf("[SinricPro]: Connected\r\n"); }); SinricPro.onDisconnected([]{ Serial.printf("[SinricPro]: Disconnected\r\n"); }); SinricPro.begin(APP_KEY, APP_SECRET); };

void setupWiFi() { WiFi.begin(SSID, PASS); Serial.printf("[WiFi]: Connecting to %s", SSID); while (WiFi.status() != WL_CONNECTED) { Serial.printf("."); delay(250); } Serial.printf("connected\r\n"); }

void setup() { Serial.begin(BAUD_RATE); setupWiFi(); setupSinricPro(); }

/****

void loop() { SinricPro.handle(); }

kakopappa commented 1 year ago

Hi,

Looks like you are using a custom device type.

Custom device types are not supported in Google home. There’s a warning message when you create a device you might have missed it

On Fri, 2 Dec 2022 at 12:04 PM chongy076 @.***> wrote:

Hi ,

in Sincric web i can control the device , but when google home linking to Sinric. It said device not found (only setup 1 device) . please add device or temporary got problem try again later. and log said " googlehome-action | Google Home action linked googlehome-action | Logged in with username and password

" no matter how many times also same.

/*

// Custom devices requires SinricPro ESP8266/ESP32 SDK 2.9.6 or later

// Uncomment the following line to enable serial debug output //#define ENABLE_DEBUG

ifdef ENABLE_DEBUG

define DEBUG_ESP_PORT Serial

define NODEBUG_WEBSOCKETS

define NDEBUG

endif

include

ifdef ESP8266

include

endif

ifdef ESP32

include

endif

include

include "SolarInverter.h"

//#include "SinricProSwitch.h"

define APP_KEY "todo"

define APP_SECRET "todo"

define DEVICE_ID "todo"

define SSID "todo"

define PASS "todo"

define BAUD_RATE 115200

ifdef ESP8266

define RELAY_PIN 2 // Pin where the relay is connected (D5 = GPIO 14 on

ESP8266)

endif

SolarInverter &solarInverter = SinricPro[DEVICE_ID]; //SinricProSwitch& mySwitch = SinricPro[DEVICE_ID]; // create new switch device /*****

  • Variables *

  • Global variables to store the device states * ***/

// ToggleController std::map<String, bool> globalToggleStates;

/*****

  • Callbacks * *****/

// ToggleController bool onToggleState(const String& deviceId, const String& instance, bool &state) { Serial.printf("[Device: %s]: State for "%s" set to %s\r\n", deviceId.c_str(), instance.c_str(), state ? "on" : "off"); globalToggleStates[instance] = state; return true; }

/**

  • Events *

  • Examples how to update the server status when *
  • you physically interact with your device or a *
  • sensor reading changes. * *****/

// ToggleController void updateToggleState(String instance, bool state) { digitalWrite(RELAY_PIN, state); // set pin state

Serial.printf("[Update Device:]: State for "%s" set to %s\r\n", instance.c_str(), state ? "on" : "off"); solarInverter.sendToggleStateEvent(instance, state); }

/

bool onPowerState(const String &deviceId, bool &state) { digitalWrite(RELAY_PIN, state); // set pin state Serial.printf("[Power Device:%s]: State set to %s\r\n", deviceId.c_str(), state ? "on" : "off"); return true; // request handled properly }/ /*****

  • Setup * *****/

void setupSinricPro() { pinMode(RELAY_PIN, OUTPUT); // set relay-pin to output mode

// ToggleController //mySwitch.onPowerState(onPowerState); // apply onPowerState callback solarInverter.onToggleState("toggleInstance1", onToggleState);

SinricPro.onConnected([]{ Serial.printf("[SinricPro]: Connected\r\n"); }); SinricPro.onDisconnected([]{ Serial.printf("[SinricPro]: Disconnected\r\n"); }); SinricPro.begin(APP_KEY, APP_SECRET); };

void setupWiFi() { WiFi.begin(SSID, PASS); Serial.printf("[WiFi]: Connecting to %s", SSID); while (WiFi.status() != WL_CONNECTED) { Serial.printf("."); delay(250); } Serial.printf("connected\r\n"); }

void setup() { Serial.begin(BAUD_RATE); setupWiFi(); setupSinricPro(); }

/****

  • Loop * ****/

void loop() { SinricPro.handle(); }

— Reply to this email directly, view it on GitHub https://github.com/sinricpro/feature-requests/issues/17, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZUQFPFFCZ4T47L7RX3WLF7MFANCNFSM6AAAAAASRQQDIY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

chongy076 commented 1 year ago

I am using ESP8266, but i managed to add to google home via smart things.

But I hope someone may have found away directly add sinric pro device ESP8266 directly to google home.

kakopappa commented 1 year ago

closing this issue since it's not a feature request. if you have any issues please raise a new issue in https://github.com/sinricpro/non-sdk-issues

chongy076 commented 1 year ago

Thank you