Closed tractorste closed 1 year ago
Hi,
1) Are you using the latest SDK version?
2) can you share the code without credentials?
On Thu, 24 Nov 2022 at 10:58 PM tractorste @.***> wrote:
Hi,
I get the following error in the activity log for the majority of my temperature update events:
Invalid Signature. The timestamp is to old, it must be at most 1 min before the servers current date and time.
using the following function:
SinricProTemperaturesensor& Temperature1 = SinricPro[TEMPERATURE_ID]; const bool Success = Temperature1.sendTemperatureEvent(TemperatureFloat);
At the same time each day one gets through. I'm trying to do this every couple of minutes. Do I need to update the time on my ESP or something?
Thanks, Steven
— Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/301, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZR5MLIKKKKB7MIGKETWJ6GB3ANCNFSM6AAAAAASKRL6RA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Thanks for the very quick response. Sorry, I've just realised that this may have been fixed in V2.10.2, I'm currently using V2.10.1 because that is the latest available on the PlatformIO. I'm guessing I should be able to pull manually from something like:
https://github.com/sinricpro/esp8266-esp32-sdk#2.10.2
The Sinric part of the code is as follows
#include "smart.h"
#include "SinricPro.h"
#include "SinricProBlinds.h"
#include "SinricProTemperatureSensor.h"
#include "motion.h"
#include "web.h"
bool CSmart::mEnabled = false;
void CSmart::Initialise()
{
// Get a new Blinds device from SinricPro
SinricProBlinds& Curtains1 = SinricPro[CURTAINS_ID];
Curtains1.onPowerState(OnPowerState);
Curtains1.onRangeValue(OnRangeValue);
Curtains1.onAdjustRangeValue(OnAdjustRangeValue);
SinricProTemperaturesensor& Temperature1 = SinricPro[TEMPERATURE_ID];
Temperature1.onPowerState(OnPowerState);
// 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);
}
void CSmart::Background()
{
if (mEnabled == true) {
SinricPro.handle();
}
}
void CSmart::SendTemperature(INT16 Temperature)
{
FP32 TemperatureFloat = Temperature;
TemperatureFloat /= 10;
SinricProTemperaturesensor& Temperature1 = SinricPro[TEMPERATURE_ID];
const bool Success = Temperature1.sendTemperatureEvent(TemperatureFloat);
if (Success == true) {
Serial.printf("Sent temperature");
} else {
Serial.printf("Temperature send failed");
}
}
bool CSmart::OnPowerState(const String& DeviceId, bool& State)
{
Serial.printf("Ignoring Power State");
return true;
}
bool CSmart::OnRangeValue(const String& DeviceId, int& Position)
{
CMotion::SetPosition(Position);
return true;
}
bool CSmart::OnAdjustRangeValue(const String& DeviceId, int& Delta)
{
// Calculate and return absolute position
Delta = CMotion::SetDelta(Delta);
return true;
}
We fixed the time stamp bug in v2.10.2 so if you can update the SDK I think it should work. Latest code in the master
https://github.com/sinricpro/esp8266-esp32-sdk/blob/master/changelog.md
Code looks good to me.
On Thu, 24 Nov 2022 at 11:13 PM tractorste @.***> wrote:
Thanks for the very quick response. Sorry, I've just realised that this may have been fixed in V2.10.2, I'm currently using V2.10.1 because that is the latest available on the PlatformIO. I'm guessing I should be able to pull manually from something like:
https://github.com/sinricpro/esp8266-esp32-sdk#2.10.2
The Sinric part of the code is as follows
include "smart.h"
include "SinricPro.h"
include "SinricProBlinds.h"
include "SinricProTemperatureSensor.h"
include "motion.h"
include "web.h"
bool CSmart::mEnabled = false;
void CSmart::Initialise() { // Get a new Blinds device from SinricPro SinricProBlinds& Curtains1 = SinricPro[CURTAINS_ID]; Curtains1.onPowerState(OnPowerState); Curtains1.onRangeValue(OnRangeValue); Curtains1.onAdjustRangeValue(OnAdjustRangeValue);
SinricProTemperaturesensor& Temperature1 = SinricPro[TEMPERATURE_ID]; Temperature1.onPowerState(OnPowerState); // 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);
}
void CSmart::Background() { if (mEnabled == true) { SinricPro.handle(); } }
void CSmart::SendTemperature(INT16 Temperature) { FP32 TemperatureFloat = Temperature; TemperatureFloat /= 10; SinricProTemperaturesensor& Temperature1 = SinricPro[TEMPERATURE_ID]; const bool Success = Temperature1.sendTemperatureEvent(TemperatureFloat); if (Success == true) { Serial.printf("Sent temperature"); } else { Serial.printf("Temperature send failed"); } }
bool CSmart::OnPowerState(const String& DeviceId, bool& State) { Serial.printf("Ignoring Power State"); return true; }
bool CSmart::OnRangeValue(const String& DeviceId, int& Position) { CMotion::SetPosition(Position); return true; }
bool CSmart::OnAdjustRangeValue(const String& DeviceId, int& Delta) { // Calculate and return absolute position Delta = CMotion::SetDelta(Delta); return true; }
— Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/301#issuecomment-1326643705, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZSBSHECNG7NETHHSKDWJ6HZPANCNFSM6AAAAAASKRL6RA . You are receiving this because you commented.Message ID: @.***>
That's all working now, thank you!
In fact 2.10.1 had that issue. ~~I don't know why the PlatformIO library registry has not yet recognised the new release. Normally this is available in the registry within a day after the release.~~
Edit: There is an issue with the library.json file (i had forgotten to update the version number). I will correct this and release it as 2.10.3
You can use lib_deps = https://github.com/sinricpro/esp8266-esp32-sdk
in platformio.ini
.
This should always give you the latest version regardless of the PlatformIO library registry.
I have fixed the version bug and released 2.10.3. This should be available via the PlatformIO library registry within 24 hours.
Sorry for the inconvenience.
Hi,
I get the following error in the activity log for the majority of my temperature update events:
Invalid Signature. The timestamp is to old, it must be at most 1 min before the servers current date and time.
using the following function:
At the same time each day one gets through. I'm trying to do this every couple of minutes. Do I need to update the time on my ESP or something?
Thanks, Steven