Skip to content

Commit a090a1e

Browse files
committed
clean6
0 parents  commit a090a1e

File tree

8 files changed

+1651
-0
lines changed

8 files changed

+1651
-0
lines changed

CONTRIBUTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Basic rules
2+
3+
+ Make the code better.
4+
+ If you do it worse, you are out.
5+
+ Better is intuitive - i.e. faster, smaller, more efficient, more robust/stable, more functional.
6+
+ Keep it simple.
7+
+ Functionality should be limited to its core aim.
8+
+ If the project should grow in undefined direction, fork it and make a separate one.
9+
10+
## Global aim
11+
12+
The aim is, that by making the code better, you/we make the world better.
13+
Still, in case if doing the code better, we will make the world worse... (unprobable, but not impossible) we need to think about it :D

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# esp32_python_eq3
2+
Bluetooth bridge between EQ3 thermostat and WLAN network, using ESP32, micropython and mqtt.
3+
4+
# Idea
5+
I used a lot of other solutions, but it seemed to be not stable for me, or hard to extend (for me :)).
6+
In order to use the esp32 for EQ3 and Mijia temperature sensors (or even some BME280-like ones) I needed to get something done on my own.
7+
8+
So I decided to rewrite it in python (micropython) on esp32.
9+
10+
This is the result. It can mimic and substitute the esp32_mqtt_eq3 solution from softypit, as it accepts the same mqtt input and returns similar mqtt json output.
11+
12+
# Other interesting liks
13+
https://github.com/softypit/esp32_mqtt_eq3

code/boot.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#-### boot.py
2+
3+
# Done by Dr.JJ
4+
# https://github.com/yunnanpl/esp32_python_eq3
5+
6+
#-###
7+
#-###
8+
#-### imports, also config and settings
9+
from secret_cfg import *
10+
# speedup/slow down for energy saving :)
11+
import machine
12+
machine.freq( config['freq'] )
13+
#from machine import Pin, DAC, PWM, ADC, SoftI2C
14+
from machine import Pin
15+
import network
16+
import ntptime
17+
import time
18+
from micropython import const
19+
import ubluetooth
20+
import gc
21+
import _thread
22+
#import umqtt
23+
import robust2 as umqtt
24+
from collections import OrderedDict
25+
26+
gc.enable()
27+
28+
#-###
29+
#-###
30+
#-### activate ble
31+
ble = ubluetooth.BLE()
32+
if ble.active() == False:
33+
ble.active( True )
34+
35+
#-###
36+
#-###
37+
#-### create timers
38+
timer_scan = machine.Timer(0)
39+
timer_work = machine.Timer(1)
40+
timer_clean = machine.Timer(2)
41+
42+
#-###
43+
#-###
44+
#-### conenct to network
45+
station = network.WLAN(network.STA_IF)
46+
station.active(True)
47+
#station.connect( config['wifi_name'], binascii.a2b_base64( config['wifi_pass'] ) )
48+
station.connect( config['wifi_name'], "".join( [ chr(x) for x in config['wifi_pass'] ] ) )
49+
50+
#-###
51+
#-###
52+
#-### waiting for connection
53+
while station.isconnected() == False:
54+
#print('LOG waiting for connection')
55+
time.sleep(1) # sleep or pass
56+
57+
#-###
58+
#-###
59+
#-### getting ntp time
60+
ntptime.host = config['ntp_host']
61+
ntptime.settime()
62+
#print('LOG NTP time set')
63+
64+
import webrepl
65+
webrepl.start()
66+
67+
#-###
68+
#-###
69+
#-### clean up the memory and stuff
70+
config = ''
71+
del config
72+
# a lot of garbage expected :D
73+
gc.collect()
74+
75+
#-### BOOTED
76+
#-### end

0 commit comments

Comments
 (0)