Add Berry example for HeatFan WiFi Controller

This commit is contained in:
Theo Arends 2025-01-30 13:56:05 +01:00
parent 0dcd38186f
commit f4bc628940
3 changed files with 29 additions and 16 deletions

View File

@ -16,9 +16,10 @@ All notable changes to this project will be documented in this file.
- Berry driver for AXP2102 and M5CoreS3 (#22878)
- GPS driver select baudrate using GPIO GPS_RX1 (9600bps), GPS_RX2 (19200bps) or GPS_RX3 (38400bps) (#22869)
- LVLG/HASPmota add color names from OpenHASP (#22879)
- HASPmota support for `buttonmatrix` events
- Berry driver for PN532 NFC/Mifare reader
- Berry `tasmota.add_rule_once` and auto-remove rules with same pattern and id
- HASPmota support for `buttonmatrix` events (#22898)
- Berry driver for PN532 NFC/Mifare reader (#22899)
- Berry `tasmota.add_rule_once` and auto-remove rules with same pattern and id (#22900)
- Berry example for HeatFan WiFi Controller
### Breaking Changed

View File

@ -131,17 +131,21 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- ESP32 expand `Pixels` with reverse, height and alternate [#22755](https://github.com/arendst/Tasmota/issues/22755)
- Display template for Waveshare ESP32-C6 LCD 1.47 [#22863](https://github.com/arendst/Tasmota/issues/22863)
- Berry `animate.crenel` primitive [#22673](https://github.com/arendst/Tasmota/issues/22673)
- Berry scroll to Leds_matrix [#22693](https://github.com/arendst/Tasmota/issues/22693)
- Berry add unicode encoding to string parsing [#22713](https://github.com/arendst/Tasmota/issues/22713)
- Berry `tasmota.int(v, min, max)` function [#22723](https://github.com/arendst/Tasmota/issues/22723)
- Berry driver for M5Stack 8encoder [#22724](https://github.com/arendst/Tasmota/issues/22724)
- Berry add light_pixels values to `tasmota.settings` [#22762](https://github.com/arendst/Tasmota/issues/22762)
- Berry add `bytes().appendhex()` [#22767](https://github.com/arendst/Tasmota/issues/22767)
- Berry WS2812 real-time Leds panel as app [#22788](https://github.com/arendst/Tasmota/issues/22788)
- Berry `bytes().appendhex()` [#22767](https://github.com/arendst/Tasmota/issues/22767)
- Berry `serial.read()` read only `n` bytes [#22835](https://github.com/arendst/Tasmota/issues/22835)
- Berry `tasmota.global.tele_period` and `tasmota.settings.tele_period` [#22865](https://github.com/arendst/Tasmota/issues/22865)
- Berry `tasmota.add_rule_once` and auto-remove rules with same pattern and id [#22900](https://github.com/arendst/Tasmota/issues/22900)
- Berry driver for M5Stack 8encoder [#22724](https://github.com/arendst/Tasmota/issues/22724)
- Berry driver for AXP2102 and M5CoreS3 [#22878](https://github.com/arendst/Tasmota/issues/22878)
- Berry driver for PN532 NFC/Mifare reader [#22899](https://github.com/arendst/Tasmota/issues/22899)
- Berry example for HeatFan WiFi Controller
- Berry WS2812 real-time Leds panel as app [#22788](https://github.com/arendst/Tasmota/issues/22788)
- Berry scroll to Leds_matrix [#22693](https://github.com/arendst/Tasmota/issues/22693)
- Berry unicode encoding to string parsing [#22713](https://github.com/arendst/Tasmota/issues/22713)
- Berry light_pixels values to `tasmota.settings` [#22762](https://github.com/arendst/Tasmota/issues/22762)
- LVLG/HASPmota add color names from OpenHASP [#22879](https://github.com/arendst/Tasmota/issues/22879)
- HASPmota support for `buttonmatrix` events [#22898](https://github.com/arendst/Tasmota/issues/22898)
### Breaking Changed

View File

@ -7,7 +7,7 @@
-#
#------------------------------------------------------------
Version v1.2.4
Version v1.2.5
ESP32-C2 based HeatFan WiFi Controller using Tasmota and Berry local CH Fan control
https://heatfan.eu/product/wifi-controller/
@ -108,7 +108,7 @@ class heatfan_cls
#-----------------------------------------------------------#
def init()
self.version = "1.2.4"
self.version = "1.2.5"
self.persist_load()
self.teleperiod = 0
self.mode_states = 6 # Number of modes (needs var as static doesn't work)
@ -121,7 +121,16 @@ class heatfan_cls
tasmota.log(f"HFN: HeatFan {self.version} started on {self.hostname}", 2)
tasmota.add_driver(self)
if global.heatfan_driver
global.heatfan_driver.stop() # Let previous instance bail out cleanly
end
tasmota.add_driver(global.heatfan_driver := self)
tasmota.add_rule("Analog#Range1", / value -> self.rule_range(value))
end
def stop()
tasmota.remove_driver(self)
tasmota.remove_rule("Analog#Range1")
end
#-----------------------------------------------------------#
@ -264,7 +273,8 @@ class heatfan_cls
end
def web_add_main_button()
webserver.content_send(f"<p></p><button onclick='la(\"&m_group_rotate=1\");'>Rotate Group Modes</button><div style='text-align:right;font-size:11px;color:#aaa;'>HeatFan {self.version}</div>")
webserver.content_send("<p></p><button onclick='la(\"&m_group_rotate=1\");'>Rotate Group Modes</button>")
webserver.content_send(f"<div style='text-align:right;font-size:11px;color:#aaa;'>HeatFan {self.version}</div>")
end
end
@ -289,9 +299,7 @@ tasmota.cmd("webrefresh 1000") # Update GUI every second
tasmota.cmd("Tempres 2") # ADC2/3 temperature resolution
tasmota.cmd("Freqres 2") # ADC1 Range resolution
tasmota.cmd("Teleperiod 60") # Update HA every minute
#tasmota.cmd("AdcGpio0 400,1710,60,20") # ADC1 range
tasmota.add_rule("Analog#Range1", / value -> heatfan.rule_range(value))
tasmota.cmd("AdcGpio0 400,1710,60,20") # ADC1 range
if 0 == mode
tasmota.set_power(0, false) # Set mode 0