smeisner / smart-thermostat Goto Github PK
View Code? Open in Web Editor NEWOpen-source ESP32-based thermostat that has some useful intelligence
License: GNU General Public License v3.0
Open-source ESP32-based thermostat that has some useful intelligence
License: GNU General Public License v3.0
Once motion is detected and the backlight is turned on, the backlight level should keep adjusting to match ambient light in case the user turns on the room light.
Once the onboard MCU is switched to the ESP32-C6 (which has Zigbee support), research must be done to figure out how to enable Zigbee on it. This will allow comms with home automation systems.
Must be able to be enabled/disabled via user config on touchscreen.
(G) Fan must be energized whenever (W) HEAT or (Y) COOL is asserted.
Whenever settings change, save them to the NV storage area. This can include:
Add a facility to log events and provide a recall buffer for review
When a task is created to run the web server, the MCU crashes. Haven't investigated it too much yet, but it's easy to repro.
Add simple telnet based CLI to set parameters, review logs and restart thermostat
To get rid of Arduino dependencies, we need to switch to the ESP-IDF framework. Most libraries are already ESP-IDF compliant. The problem (I believe) is with the DFRobot AHT20 library. It relies on the Arduino framework, specifically the I2C library.
Looking at the ESP32 partition, there is a partition that can be used for logging;
## Label Usage Type ST Offset Length
4 spiffs Unknown data 01 82 0x00c90000 0x00360000
Use this area to record ESP32 logging, including panic data.
Hello there, I was looking at your code and was wondering if you managed to set the temperature into the matter protocol, I just noticed this part local_temperature, or do you have any clue on how to send the temperature via matter?
Enable automatically updating the firmware if a new version is located on Github. The code to apply a new firmware image is included in the web.cpp file.
Auto updating must be able to be enabled/disabled via user config on touchscreen.
If the thermostat NVRAM is found to be uninitialized (no wifi credentials), enable BLE to allow config via a smartphone.
Report motion and light level back via MQTT. This will allow home automation systems to take action based on sensor data.
With the RCWL-0516 mounted upside down (looking at rear of board), it is constantly triggering for motion. This makes the sensor virtually useless.
Add support for MQTT to push events to home automation systems. Maybe also use MQTT to subscribe to events to allow HA to control the thermostat.
This feature would need to enabled/disabled via the user config.
The MQTT source code was developed (and it is working) without concern for code documentation or cleaning up old code. A full review of th emodul eis required to document (comments) and cleanup the code, including structure.
Add support for an NTP client. This will provide local time of day, but will not work if network connection is down or not allowed.
There is no way to have the thermostat automatically adjust the time for areas that support daylight savings time.
A nice looking user interface must be designed and implemented to support the touchscreen and provide local weather backgrounds.
Crashed while wifi was dropping and connection reestablished:
[19761.20h.02m.32s.829] I (196938675) SENSORS: Temp: 75.1 (raw: 80.60 F) Humidity: 34.0 (raw: 21.71)
[19761.20h.02m.32s.836] I (196938675) MQTT: {"Temperature":"75.06","Humidity":"34.02","Setpoint":74,"Mode":"heat","CurrMode":"idle"}
[19761.20h.02m.42s.918] I (196948765) SENSORS: Temp: 75.0 (raw: 80.57 F) Humidity: 33.7 (raw: 20.84)
[19761.20h.02m.42s.926] I (196948765) MQTT: {"Temperature":"75.01","Humidity":"33.70","Setpoint":74,"Mode":"heat","CurrMode":"idle"}
[19761.20h.02m.53s.008] I (196958855) SENSORS: Temp: 75.0 (raw: 80.54 F) Humidity: 33.4 (raw: 20.24)
[19761.20h.02m.53s.015] I (196958855) MQTT: {"Temperature":"74.96","Humidity":"33.36","Setpoint":74,"Mode":"heat","CurrMode":"idle"}
[19761.20h.03m.03s.099] I (196968945) SENSORS: Temp: 74.9 (raw: 80.47 F) Humidity: 33.0 (raw: 19.91)
[19761.20h.03m.03s.106] I (196968945) MQTT: {"Temperature":"74.91","Humidity":"33.01","Setpoint":74,"Mode":"heat","CurrMode":"idle"}
[19761.20h.03m.13s.188] I (196979035) SENSORS: Temp: 74.9 (raw: 80.43 F) Humidity: 32.7 (raw: 19.79)
[19761.20h.03m.13s.195] I (196979035) MQTT: {"Temperature":"74.87","Humidity":"32.69","Setpoint":74,"Mode":"heat","CurrMode":"idle"}
[19761.20h.03m.23s.278] I (196989125) SENSORS: Temp: 74.8 (raw: 80.39 F) Humidity: 32.4 (raw: 19.33)
[19761.20h.03m.23s.285] I (196989125) MQTT: {"Temperature":"74.82","Humidity":"32.35","Setpoint":74,"Mode":"heat","CurrMode":"idle"}
[19761.20h.03m.24s.853] I (196990705) SENSORS: Current time: 15:03:24
[19761.20h.03m.33s.369] I (196999215) SENSORS: Temp: 74.8 (raw: 80.33 F) Humidity: 32.0 (raw: 19.06)
[19761.20h.03m.33s.376] I (196999215) MQTT: {"Temperature":"74.77","Humidity":"32.02","Setpoint":74,"Mode":"heat","CurrMode":"idle"}
[19761.20h.03m.39s.383] I (197005235) wifi:bcn_timeout,ap_probe_send_start
[19761.20h.03m.41s.885] I (197007735) wifi:ap_probe_send over, resett wifi status to disassoc
[19761.20h.03m.41s.885] I (197007735) wifi:state: run -> init (c800)
[19761.20h.03m.41s.890] I (197007735) wifi:pm stop, total sleep time: 92468438 us / 130538481 us
[19761.20h.03m.41s.890]
[19761.20h.03m.41s.894] I (197007735) wifi:<ba-del>idx:0, tid:0
[19761.20h.03m.41s.901] I (197007745) wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1
[19761.20h.03m.41s.907] I (197007755) telnet: Telnet session termination requested
[19761.20h.03m.41s.913] I (197007755) telnet: Starting new telnet service instance
[19761.20h.03m.41s.923] E (197007765) transport_base: poll_read select error 113, errno = Software caused connection abort, fd = 62
[19761.20h.03m.41s.930] E (197007775) mqtt_client: Poll read error: 119, aborting connection
[19761.20h.03m.41s.935] I (197007775) MQTT: MQTT_EVENT_DISCONNECTED
[19761.20h.03m.41s.941] I (197007785) telnet: Telnet session termination requested
[19761.20h.03m.41s.950] W (197007785) telnet: No action taken - no telnet connection and telnet task not started
[19761.20h.03m.42s.033] I (197007885) WIFI: event = STA_DISCONECTED - retry # 0 (MAX 5)
[19761.20h.03m.42s.034] W (197007885) WIFI: connect to the AP failed - retrying
[19761.20h.03m.42s.039] I (197007885) telnet: Start telnetTask()
[19761.20h.03m.42s.053] W (197007905) WIFI: Starting network reconnect task
[19761.20h.03m.42s.053] I (197007905) WIFI: wifiReconnect()
[19761.20h.03m.42s.055] I (197007905) wifi:flush txq
[19761.20h.03m.42s.057] I (197007905) wifi:stop sw txq
[19761.20h.03m.42s.061] I (197007905) wifi:lmac stop hw txq
[19761.20h.03m.42s.064] W (197007905) WIFI: WifiDeinit()
[19761.20h.03m.42s.068] I (197007915) wifi:Deinit lldesc rx mblock:10
[19761.20h.03m.42s.078] I (197007925) WIFI: - Restarting wifi
[19761.20h.03m.42s.078] I (197007925) WIFI: wifiStart()
[19761.20h.03m.42s.084] W (197007925) WIFI: Wifi driver not started; Calling init and create funcs
[19761.20h.03m.42s.088] I (197007935) WIFI: Initializing wifi
[19761.20h.03m.42s.093] I (197007935) WIFI: Setting wifi hostname
[19761.20h.03m.42s.098] I (197007945) pp: pp rom version: e7ae62f
[19761.20h.03m.42s.104] I (197007945) net80211: net80211 rom version: e7ae62f
[19761.20h.03m.42s.112] I (197007965) wifi:wifi driver task: 3fcbab5c, prio:23, stack:6656, core=0
[19761.20h.03m.42s.122] I (197007975) wifi:wifi firmware version: ce9244d
[19761.20h.03m.42s.123] I (197007975) wifi:wifi certification version: v7.0
[19761.20h.03m.42s.124] I (197007975) wifi:config NVS flash: enabled
[19761.20h.03m.42s.129] I (197007975) wifi:config nano formating: disabled
[19761.20h.03m.42s.134] I (197007975) wifi:Init data frame dynamic rx buffer num: 32
[19761.20h.03m.42s.140] I (197007985) wifi:Init management frame dynamic rx buffer num: 32
[19761.20h.03m.42s.145] I (197007985) wifi:Init management short buffer num: 32
[19761.20h.03m.42s.150] I (197007995) wifi:Init dynamic tx buffer num: 32
[19761.20h.03m.42s.154] I (197007995) wifi:Init static tx FG buffer num: 2
[19761.20h.03m.42s.159] I (197008005) wifi:Init static rx buffer size: 1600
[19761.20h.03m.42s.163] I (197008005) wifi:Init static rx buffer num: 10
[19761.20h.03m.42s.167] I (197008015) wifi:Init dynamic rx buffer num: 32
[19761.20h.03m.42s.172] I (197008015) wifi_init: rx ba win: 6
[19761.20h.03m.42s.176] I (197008025) wifi_init: tcpip mbox: 32
[19761.20h.03m.42s.181] I (197008025) wifi_init: udp mbox: 6
[19761.20h.03m.42s.185] I (197008025) wifi_init: tcp mbox: 6
[19761.20h.03m.42s.189] I (197008035) wifi_init: tcp tx win: 5744
[19761.20h.03m.42s.194] I (197008035) wifi_init: tcp rx win: 5744
[19761.20h.03m.42s.199] I (197008045) wifi_init: tcp mss: 1440
[19761.20h.03m.42s.204] I (197008045) wifi_init: WiFi IRAM OP enabled
[19761.20h.03m.42s.209] I (197008055) wifi_init: WiFi RX IRAM OP enabled
[19761.20h.03m.42s.214] I (197008055) WIFI: MAC Address: 34:85:18:50:7b:88
[19761.20h.03m.42s.220] I (197008065) WIFI: Calling esp_wifi_start()
[19761.20h.03m.42s.225] I (197008065) wifi:mode : sta (34:85:18:50:7b:88)
[19761.20h.03m.42s.231] I (197008075) wifi:enable tsf
[19761.20h.03m.42s.882] I (197008075) WIFI: Waiting for event callback...
[19761.20h.03m.42s.882] I (197008725) wifi:new:<6,0>, old:<1,0>, ap:<255,255>, sta:<6,0>, prof:1
[19761.20h.03m.42s.883] I (197008735) wifi:state: init -> auth (b0)
[19761.20h.03m.42s.891] I (197008735) wifi:state: auth -> assoc (0)
[19761.20h.03m.43s.459] I (197009305) SENSORS: Temp: 74.7 (raw: 80.28 F) Humidity: 31.7 (raw: 19.20)
[19761.20h.03m.43s.892] I (197009735) wifi:state: assoc -> init (2700)
[19761.20h.03m.43s.893] I (197009745) wifi:new:<6,0>, old:<6,0>, ap:<255,255>, sta:<6,0>, prof:1
[19761.20h.03m.43s.897] I (197009745) telnet: Telnet session termination requested
[19761.20h.03m.43s.904] I (197009745) telnet: Starting new telnet service instance
[19761.20h.03m.44s.022] I (197009875) WIFI: event = STA_DISCONECTED - retry # 0 (MAX 5)
[19761.20h.03m.44s.024] W (197009875) WIFI: connect to the AP failed - retrying
[19761.20h.03m.44s.029] I (197009875) telnet: Start telnetTask()
[19761.20h.03m.45s.237] I (197011085) wifi:new:<11,0>, old:<6,0>, ap:<255,255>, sta:<11,0>, prof:1
[19761.20h.03m.45s.239] I (197011085) wifi:state: init -> auth (b0)
[19761.20h.03m.45s.243] I (197011095) wifi:state: auth -> assoc (0)
[19761.20h.03m.45s.249] I (197011095) wifi:state: assoc -> run (10)
[19761.20h.03m.45s.286] I (197011135) wifi:connected with <ssid>, aid = 2, channel 11, BW20, bssid = f0:9f:c2:a7:10:90
[19761.20h.03m.45s.288] I (197011135) wifi:security: WPA2-PSK, phy: bgn, rssi: -64
[19761.20h.03m.45s.297] I (197011145) wifi:pm start, type: 1
[19761.20h.03m.45s.297]
[19761.20h.03m.45s.300] I (197011145) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 25000, mt_pti: 0, mt_time: 10000
[19761.20h.03m.45s.308] I (197011155) wifi:<ba-add>idx:0 (ifx:0, f0:9f:c2:a7:10:90), tid:0, ssn:0, winSize:64
[19761.20h.03m.45s.352] I (197011195) wifi:AP's beacon interval = 102400 us, DTIM period = 3
[19761.20h.03m.46s.304] I (197012155) esp_netif_handlers: sta ip: 192.168.0.71, mask: 255.255.255.0, gw: 192.168.0.254
[19761.20h.03m.46s.309] I (197012155) WIFI: event = IP_EVENT_STA_GOT_IP - ip: 192.168.0.71
[19761.20h.03m.46s.315] I (197012155) WIFI: connected to ap SSID:<ssid> password:****
[19761.20h.03m.51s.943] E (197017795) esp-tls: Failed to create socket (family 2 socktype 1 protocol 0)
[19761.20h.03m.51s.947] E (197017795) transport_base: Failed to open a new connection: 32770
[19761.20h.03m.51s.953] E (197017795) mqtt_client: Error transport connect
[19761.20h.03m.51s.957] I (197017805) MQTT: MQTT_EVENT_ERROR
[19761.20h.03m.51s.962] I (197017805) MQTT: MQTT_EVENT_DISCONNECTED
[19761.20h.03m.51s.968] I (197017805) telnet: Telnet session termination requested
[19761.20h.03m.51s.974] I (197017815) telnet: Starting new telnet service instance
[19761.20h.03m.52s.098] I (197017945) telnet: Start telnetTask()
[19761.20h.03m.52s.118] E (197017965) telnet: bind: 9 (Bad file number)
[19761.20h.03m.52s.118] I (197017965) telnet: Completing telnetTask()
[19761.20h.03m.53s.538] I (197019385) SENSORS: Temp: 74.7 (raw: 80.24 F) Humidity: 31.5 (raw: 18.91)
[19761.20h.04m.02s.094] E (197027945) esp-tls: Failed to create socket (family 2 socktype 1 protocol 0)
[19761.20h.04m.02s.097] E (197027945) transport_base: Failed to open a new connection: 32770
[19761.20h.04m.02s.103] E (197027945) mqtt_client: Error transport connect
[19761.20h.04m.02s.127] I (197027955) MQTT: MQTT_EVENT_ERROR
[19761.20h.04m.02s.127] I (197027955) MQTT: MQTT_EVENT_DISCONNECTED
[19761.20h.04m.02s.127] I (197027965) telnet: Telnet session termination requested
[19761.20h.04m.02s.127] E (197027965) telnet: closesocket: 9 (Bad file number)
[19761.20h.04m.02s.135] Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled.
[19761.20h.04m.02s.135]
[19761.20h.04m.02s.135] Core 0 register dump:
[19761.20h.04m.02s.135] PC : 0x403820d5 PS : 0x00060d33 A0 : 0x80380397 A1 : 0x3fccb060
[19761.20h.04m.02s.146] A2 : 0x3fcc6744 A3 : 0x00060d20 A4 : 0x00000000 A5 : 0x00060d23
[19761.20h.04m.02s.157] A6 : 0xb33fffff A7 : 0xb33fffff A8 : 0x967c967c A9 : 0x967c967c
[19761.20h.04m.02s.157] A10 : 0x967c967c A11 : 0x00000000 A12 : 0x00000000 A13 : 0x3fccb050
[19761.20h.04m.02s.168] A14 : 0x3fccb030 A15 : 0x0000000c SAR : 0x00000004 EXCCAUSE: 0x0000001d
[19761.20h.04m.02s.179] EXCVADDR: 0x967c9684 LBEG : 0x400556d5 LEND : 0x400556e5 LCOUNT : 0xfffffffc
[19761.20h.04m.02s.190]
[19761.20h.04m.02s.190]
[19761.20h.04m.02s.190] Backtrace: 0x403820d2:0x3fccb060 0x40380394:0x3fccb080 0x4200a198:0x3fccb0a0 0x42004d54:0x3fccb0c0 0x420f0385:0x3fccb110 0x420efe0a:0x3fccb140 0x420435cd:0x3fccb180 0x42043817:0x3fccb1a0 0x420438de:0x3fccb1c0 0x42044519:0x3fccb1e0 0x40381589:0x3fccb210
[19761.20h.04m.02s.221]
Research usefulness and ability to fetch weather & temp for the local area (via something like wunderground.com). The local weather can then be used to set the background graphics on the touch screen.
An override to the current set temp. If the thermostat is set at 68F/20C and very cold weather is expected, you should be able to set the temp a little higher and hold until the user disables it.
Provide tech docs on PCB / MCU (such as use of IO pins) and software.
It has been requested to have a feature on the thermostat that allows for a "one shot" activation of the HVAC system. Not based on temperature, but more based on having a quick excessive heat/cool to increase comfort.
For example, it's a very hot day and you come in from doing yard work. You want the air conditioning to come on, but you don't want the temperature set to 50F/10C indefinitely.
therefore, having a feature to run the heat or cool for a set time (maybe 15 minutes) and then resume normal operation would be useful.
Via the TX1 & RX1 pins, program the LD2410 to tune the distance and sensitivity of the presence sensor.
After the ESP32-C6 MCU is incorporated, research how to enable Thread protocol to support Matter. This allows for integration into home automation systems.
Must be able to be enabled/disabled via user config on touchscreen.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.