huseman21 / Arduiono-Thermostat-With-Sinric-Pro

This is a home thermostat with a remote temperature sending unit created to run on an ESP8266 using the Sinricpro alexa voice interface
1 stars 0 forks source link

Crash when setting temperature #1

Open TERM4X opened 1 year ago

TERM4X commented 1 year ago

I've uploaded the thermostat.ino in my esp8266, and the "turn off/on" and "change mode" functions from sinric does work, but when I change the "target" temperature (from sinric or from the google home app it doesn't change) the esp8266 gives a lot of messages in the serial monitor and then reset itself. The output on the serial monitor when I try to change the temperature is: " Thermostat 6335620716440f13ff6fa23f set temperature to 9.000000

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (29): epc1=0x40201694 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00f00d10 depc=0x00000000

stack>>>

ctx: cont sp: 3ffffbf0 end: 3fffffc0 offset: 0190 3ffffd80: 3ffeef80 3ffeefe0 3ffeeffc 40201684
3ffffd90: 3fff882c 3ffeefe0 3fff0958 40210bb4
3ffffda0: 3fff8512 00000020 3fff0958 40204598
3ffffdb0: 3fff10b4 00000018 3ffffe40 4020bb9b
3ffffdc0: 00001058 00001058 3ffe85ec 41100000
3ffffdd0: 00000001 3fff10b4 3ffffe40 00000000
3ffffde0: 3fff1144 3ffffe40 3fff1134 40210cb0
3ffffdf0: 3fff8552 3fff0d2c 3ffffe40 402011f8
3ffffe00: 00000001 3fff0d2c 3ffef118 40205516
3ffffe10: 3fff85a0 3ffefeb0 3fff88e4 3fff8946
3ffffe20: 3fff8c14 3fff8ce4 3fff8800 4020579b
3ffffe30: 3fff8cd4 3fff8ca4 3ffffe20 00000030 3ffffe40: 3ffffe74 3ffffe68 3ffffea0 3ffffe98
3ffffe50: 38334d50 6f63497a 66555330 41715566
3ffffe60: 4151736c 6c515944 00000000 6a596431
3ffffe70: 00000000 3fff1254 0011001f 80000000
3ffffe80: 00000000 00000000 3fff882c 3ffffef8
3ffffe90: 3fff8c14 3ffffe18 3fff8c14 3ffffe18
3ffffea0: 3fff882c 3ffffef8 3ffe85ec 40100fab
3ffffeb0: 3fff0d30 3fff8552 00000001 3ffe8df7
3ffffec0: 3ffe8e00 3ffef118 6336c4ea 4020309c
3ffffed0: 3ffe8dd5 3fff10f4 3ffef118 3ffffef8
3ffffee0: 3ffef2c8 3fff10f4 3ffef118 402058fa
3ffffef0: 00000010 00000000 3fff84dc 3fff85f6
3fffff00: 3fff87fc 3fff88dc 67ae1400 007c3d6f
3fffff10: 3fff88cc 3fff880c 4bc6a720 00000000
3fffff20: 75716572 00747365 07000000 3ffe8dc6
3fffff30: 00000000 002c002f 00000000 00000000
3fffff40: 00d900df 00000000 00000000 002c002f
3fffff50: 00000000 3ffef2a8 3ffef118 40205bce
3fffff60: 00000001 3ffe8e0a 3ffef14c 402099fc
3fffff70: 00000000 fb2ba8c0 feefeffe 3ffef614
3fffff80: 3fffdad0 00000000 3ffef118 40205c7e
3fffff90: 3fffdad0 00000000 3ffef600 40205c9b 3fffffa0: 3fffdad0 00000000 3ffef600 4020c818
3fffffb0: feefeffe feefeffe 3ffe85e8 40101519
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3460, room 16 tail 4 chksum 0xcc load 0x3fff20b8, len 40, room 4 tail 4 chksum 0xc9 csum 0xc9 v00069350 ~ld "

and then it resets itself. I didn't connect any sensor or nothing, but I can't figure out why it does crash

(sry but English is not my main language)

huseman21 commented 1 year ago

image

Hello, I hope your day is going good.

Its been 2 years the last time I saw this code. It has been running my ac/heat this entire time. I have noticed bugs in the (auto) mode, I'll need to go back and see why that goofs up, so i've been avoiding that mode. Anyways,

I would try removing the extra's that you may have not wired up to it to see what is causing the issue. For example remove the am radio transmitter code, lcd code, ect. Below I have included the bare minimum code to connect it to the sinric pro site, and is what I started out with. I hope this helps. Also more example can be found on sinrics GitHub page:

https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/examples

/*

// 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 <ESP8266WiFi.h>

endif

ifdef ESP32

   #include <WiFi.h>

endif

include "SinricPro.h"

include "SinricProThermostat.h"

define WIFI_SSID "YOUR_WIFI_SSID"

define WIFI_PASS "YOUR_WIFI_PASSWORD"

define APP_KEY "YOUR_APP_KEY_HERE" // Should look like "de0bxxxx-1x3x-4x3x-ax2x-5dabxxxxxxxx"

define APP_SECRET "YOUR_APP_SECRET_HERE" // Should look like "5f36xxxx-x3x7-4x3x-xexe-e86724a9xxxx-4c4axxxx-3x3x-x5xe-x9x3-333d65xxxxxx"

define THERMOSTAT_ID "YOUR_DEVICE_ID_HERE" // Should look like "5dc1564130xxxxxxxxxxxxxx"

define BAUD_RATE 9600 // Change baudrate to your need

float globalTemperature; bool globalPowerState;

bool onPowerState(const String &deviceId, bool &state) { Serial.printf("Thermostat %s turned %s\r\n", deviceId.c_str(), state?"on":"off"); globalPowerState = state; return true; // request handled properly }

bool onTargetTemperature(const String &deviceId, float &temperature) { Serial.printf("Thermostat %s set temperature to %f\r\n", deviceId.c_str(), temperature); globalTemperature = temperature; return true; }

bool onAdjustTargetTemperature(const String & deviceId, float &temperatureDelta) { globalTemperature += temperatureDelta; // calculate absolut temperature Serial.printf("Thermostat %s changed temperature about %f to %f", deviceId.c_str(), temperatureDelta, globalTemperature); temperatureDelta = globalTemperature; // return absolut temperature return true; }

bool onThermostatMode(const String &deviceId, String &mode) { Serial.printf("Thermostat %s set to mode %s\r\n", deviceId.c_str(), mode.c_str()); 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); } IPAddress localIP = WiFi.localIP(); Serial.printf("connected!\r\n[WiFi]: IP-Address is %d.%d.%d.%d\r\n", localIP[0], localIP[1], localIP[2], localIP[3]); }

void setupSinricPro() { SinricProThermostat &myThermostat = SinricPro[THERMOSTAT_ID]; myThermostat.onPowerState(onPowerState); myThermostat.onTargetTemperature(onTargetTemperature); myThermostat.onAdjustTargetTemperature(onAdjustTargetTemperature); myThermostat.onThermostatMode(onThermostatMode);

// 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 setup() { Serial.begin(BAUD_RATE); Serial.printf("\r\n\r\n"); setupWiFi(); setupSinricPro(); }

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