Closed dony2074 closed 7 months ago
The server and the app no longer support onPowerState for sensors. For this reason, version 3.0.0 was released, which is not backwards compatible - see Changelog: "BREAKING CHANGE: Remove PowerStateController from Air Quality, Contact, Motion and Temperature sensor." and the examples for the temperature sensors.
You can downgrade the sdk for 2.x
Remove mySensor.onPowerState(onPowerState);
On Sun, 19 Nov 2023 at 3:39 AM sivar2311 @.***> wrote:
The server and the app no longer support onPowerState for sensors. For this reason, version 3.0.0 was released, which is not backwards compatible - see Changelog https://github.com/sinricpro/esp8266-esp32-sdk/blob/master/changelog.md: "BREAKING CHANGE: Remove PowerStateController from Air Quality, Contact, Motion and Temperature sensor." and the examples for the temperature sensors https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/examples/temperaturesensor .
— Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/349#issuecomment-1817629509, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZWEUPLESMUZKOXYXNDYFEMHXAVCNFSM6AAAAAA7RFEDQCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXGYZDSNJQHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
You can downgrade the sdk for 2.x
Remove mySensor.onPowerState(onPowerState);
On Sun, 19 Nov 2023 at 3:39 AM sivar2311 @.***> wrote:
The server and the app no longer support onPowerState for sensors. For this reason, version 3.0.0 was released, which is not backwards compatible - see Changelog https://github.com/sinricpro/esp8266-esp32-sdk/blob/master/changelog.md: "BREAKING CHANGE: Remove PowerStateController from Air Quality, Contact, Motion and Temperature sensor." and the examples for the temperature sensors https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/examples/temperaturesensor .
— Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/349#issuecomment-1817629509, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZWEUPLESMUZKOXYXNDYFEMHXAVCNFSM6AAAAAA7RFEDQCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXGYZDSNJQHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
In file included from c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProTemperaturesensor.h:10,
from C:\Users\Dony\Downloads\TA (Code)\onpowerstate\onpowerstate.ino:10:
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h: In member function 'virtual ArduinoJson::V6213PB2::DynamicJsonDocument SINRICPRO_2_11_1::SinricProDevice::prepareEvent(const char, const char)':
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h:73:3: error: 'DEBUG_SINRIC' was not declared in this scope
DEBUG_SINRIC("[SinricProDevice:prepareEvent()]: Device "%s" isn't configured correctly! The '%s' event will be ignored.\r\n", deviceId.c_str(), action);
^~~~
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h:73:3: note: the macro 'DEBUG_SINRIC' had not yet been defined
In file included from c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProUDP.h:20,
from c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricPro.h:17,
from C:\Users\Dony\Downloads\TA (Code)\onpowerstate\onpowerstate.ino:12:
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDebug.h:20: note: it was later defined here
In file included from c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProTemperaturesensor.h:10,
from C:\Users\Dony\Downloads\TA (Code)\onpowerstate\onpowerstate.ino:10:
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h: In member function 'virtual bool SINRICPRO_2_11_1::SinricProDevice::sendEvent(ArduinoJson::V6213PB2::JsonDocument&)':
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h:79:8: error: 'SinricPro' was not declared in this scope
if (!SinricPro.isConnected()) {
^~~~~
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h:79:8: note: suggested alternative: 'SinricProClass'
if (!SinricPro.isConnected()) {
^~~~~
SinricProClass
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h:80:5: error: 'DEBUG_SINRIC' was not declared in this scope
DEBUG_SINRIC("[SinricProDevice::sendEvent]: The event could not be sent. No connection to the SinricPro server.\r\n");
^~~~
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h:80:5: note: the macro 'DEBUG_SINRIC' had not yet been defined
In file included from c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProUDP.h:20,
from c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricPro.h:17,
from C:\Users\Dony\Downloads\TA (Code)\onpowerstate\onpowerstate.ino:12:
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDebug.h:20: note: it was later defined here
exit status 1
Compilation error: exit status 1
i got this massage after downgrade my sdk
The server and the app no longer support onPowerState for sensors. For this reason, version 3.0.0 was released, which is not backwards compatible - see Changelog: "BREAKING CHANGE: Remove PowerStateController from Air Quality, Contact, Motion and Temperature sensor." and the examples for the temperature sensors.
In file included from c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProTemperaturesensor.h:10,
from C:\Users\Dony\Downloads\TA (Code)\onpowerstate\onpowerstate.ino:10:
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h: In member function 'virtual ArduinoJson::V6213PB2::DynamicJsonDocument SINRICPRO_2_11_1::SinricProDevice::prepareEvent(const char, const char)':
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h:73:3: error: 'DEBUG_SINRIC' was not declared in this scope
DEBUG_SINRIC("[SinricProDevice:prepareEvent()]: Device "%s" isn't configured correctly! The '%s' event will be ignored.\r\n", deviceId.c_str(), action);
^~~~
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h:73:3: note: the macro 'DEBUG_SINRIC' had not yet been defined
In file included from c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProUDP.h:20,
from c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricPro.h:17,
from C:\Users\Dony\Downloads\TA (Code)\onpowerstate\onpowerstate.ino:12:
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDebug.h:20: note: it was later defined here
In file included from c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProTemperaturesensor.h:10,
from C:\Users\Dony\Downloads\TA (Code)\onpowerstate\onpowerstate.ino:10:
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h: In member function 'virtual bool SINRICPRO_2_11_1::SinricProDevice::sendEvent(ArduinoJson::V6213PB2::JsonDocument&)':
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h:79:8: error: 'SinricPro' was not declared in this scope
if (!SinricPro.isConnected()) {
^~~~~
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h:79:8: note: suggested alternative: 'SinricProClass'
if (!SinricPro.isConnected()) {
^~~~~
SinricProClass
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h:80:5: error: 'DEBUG_SINRIC' was not declared in this scope
DEBUG_SINRIC("[SinricProDevice::sendEvent]: The event could not be sent. No connection to the SinricPro server.\r\n");
^~~~
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDevice.h:80:5: note: the macro 'DEBUG_SINRIC' had not yet been defined
In file included from c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProUDP.h:20,
from c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricPro.h:17,
from C:\Users\Dony\Downloads\TA (Code)\onpowerstate\onpowerstate.ino:12:
c:\Users\Dony\Documents\Arduino\libraries\SinricPro\src/SinricProDebug.h:20: note: it was later defined here
exit status 1
Compilation error: exit status 1
i got this massage after downgrade my sdk
Your include order is wrong:
#include <OneWire.h>
#include <DallasTemperature.h>
#include "SinricProTemperaturesensor.h"
#include <Wire.h>
#include "SinricPro.h"
#include "SinricProSwitch.h"
You need to include SinricPro.h
first, before including SinricPro devices like SinricProTemperaturesensor.h
Change your includes to this
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Wire.h>
#include "SinricPro.h"
#include "SinricProSwitch.h"
#include "SinricProTemperaturesensor.h"
and the code compiles fine.
Btw: This would also happen in 3.x.x and is not related to the downgrade.
Your include order is wrong:
#include <OneWire.h> #include <DallasTemperature.h> #include "SinricProTemperaturesensor.h" #include <Wire.h> #include "SinricPro.h" #include "SinricProSwitch.h"
You need to include
SinricPro.h
first, before including SinricPro devices likeSinricProTemperaturesensor.h
Change your includes to this
#include <OneWire.h> #include <DallasTemperature.h> #include <Wire.h> #include "SinricPro.h" #include "SinricProSwitch.h" #include "SinricProTemperaturesensor.h"
and the code compiles fine.
Btw: This would also happen in 3.x.x and is not related to the downgrade.
Thankyou now the code is work fine, but in the serial monitor its keep saying disconnected from sinricpro, i have assumption that maybe because the lack of electricity, or maybe because the code ?
The code looks okay. The issue must be somewhere else. WiFi, WiFi-Router, Router Network Settings.... could be many reasons.
The code looks okay. The issue must be somewhere else. WiFi, WiFi-Router, Router Network Settings.... could be many reasons.
But if i use other code like just relay the code work fine and say connected to sinric pro, is there tips for combining code from 2 relays and temperature sensor ds18b20
I took a deeper look at your code. I've found 2 things:
sensors.begin()
twice! (this shouldn't be critical but avoid this)
setupSensor()
which gets called by setup()
setup()
delay(1000)
in the loop()
function (critical!)
Try this:
void printSensorReading() {
const unsigned long millisToWait = 1000;
static unsigned long lastMillis;
unsigned long currentMillis = millis();
if (lastMillis && currentMillis - lastMillis < millisToWait ) return;
lastMillis = currentMillis;
float temperatureC = sensors.getTempCByIndex(0);
float temperatureF = sensors.getTempFByIndex(0);
Serial.print(temperatureC);
Serial.println("ºC");
Serial.print(temperatureF);
Serial.println("ºF");
}
void loop() {
SinricPro.handle();
sensors.requestTemperatures();
handleTemperaturesensor();
printSensorReading();
}
I took a deeper look at your code. I've found 2 things:
- You're calling
sensors.begin()
twice! (this shouldn't be critical but avoid this)
- it is called in
setupSensors()
which gets called bysetup()
- it is also called in
setup()
- You're calling
delay(1000)
in theloop()
function (critical!)
- this will block the whole system on every loop for 1 second and will break the connection!
- better use the "blink without delay"-idiom
Thanks for your guidance, the code work fine now
i get this error when verify my code, to upload to the esp32 board
this is my full code, sorry i just copy and paste the code from the zero code sinric pro
thanks for help and the reply