Update heatfan.be

This commit is contained in:
Theo Arends 2025-01-30 15:09:33 +01:00
parent f4bc628940
commit 9d963ce599

View File

@ -1,38 +1,38 @@
#- #-
heatfan.be - HeatFan support for Tasmota heatfan.be - HeatFan support for Tasmota
SPDX-FileCopyrightText: 2025 Theo Arends SPDX-FileCopyrightText: 2025 Theo Arends
SPDX-License-Identifier: GPL-3.0-only SPDX-License-Identifier: GPL-3.0-only
-# -#
#------------------------------------------------------------ #--------------------------------------------------------------
Version v1.2.5 Version v1.2.6
ESP32-C2 based HeatFan WiFi Controller using Tasmota and Berry local CH Fan control ESP32-C2 based HeatFan WiFi Controller using Tasmota and Berry local CH Fan control
https://heatfan.eu/product/wifi-controller/ https://heatfan.eu/product/wifi-controller/
Template {"NAME":"HeatFan","GPIO":[4864,229,228,4737,4738,224,0,225,32,448,226,0,0,0,0,0,0,0,227,0,0],"FLAG":0,"BASE":1} Template {"NAME":"HeatFan","GPIO":[4864,229,228,4737,4738,224,0,225,32,448,226,0,0,0,0,0,0,0,227,0,0],"FLAG":0,"BASE":1}
Module 0 # Enable above template Module 0 # Enable above template
SO15 1 # (Light) COLOR/DIMMER/CT/CHANNEL (1) SO15 1 # (Light) COLOR/DIMMER/CT/CHANNEL (1)
SO68 0 # (Light) Enable Color PWM (0) SO68 0 # (Light) Enable Color PWM (0)
GroupTopic2 heatfans # Allow MQTT group topic control using button "Rotate Group Modes" GroupTopic2 heatfans # Allow MQTT group topic control using buttons "Copy Mode" and "Rotate Mode"
Relay1 to Relay6 control Leds for Modes 1 to 6 (interlocked) Relay1 to Relay6 control Leds for Modes 1 to 6 (interlocked)
GPIO00 = ADC1 range (temperature input from comparator) GPIO00 = ADC1 range (temperature input from comparator)
GPIO01 = Relay6 (blue) GPIO01 = Relay6 (blue)
GPIO02 = Relay5 (red) GPIO02 = Relay5 (red)
GPIO03 = ADC2 temperature (ADC_CH_TEMP) GPIO03 = ADC2 temperature (ADC_CH_TEMP)
GPIO04 = ADC3 temperature (ADC_CH_TMCU) GPIO04 = ADC3 temperature (ADC_CH_TMCU)
GPIO05 = Relay1 (red) GPIO05 = Relay1 (red)
GPIO06 = gpio.digital_write (GPIO_FANS_EN) GPIO06 = gpio.digital_write (GPIO_FANS_EN)
GPIO07 = Relay2 (red) GPIO07 = Relay2 (red)
GPIO08 = Button1 GPIO08 = Button1
GPIO09 = PWM_i1 (20kHz fan control) GPIO09 = PWM_i1 (20kHz fan control)
GPIO10 = Relay3 (red) GPIO10 = Relay3 (red)
GPIO18 = Relay4 (red) GPIO18 = Relay4 (red)
------------------------------------------------------------# --------------------------------------------------------------#
import persist import persist
import string import string
@ -108,7 +108,7 @@ class heatfan_cls
#-----------------------------------------------------------# #-----------------------------------------------------------#
def init() def init()
self.version = "1.2.5" self.version = "1.2.6"
self.persist_load() self.persist_load()
self.teleperiod = 0 self.teleperiod = 0
self.mode_states = 6 # Number of modes (needs var as static doesn't work) self.mode_states = 6 # Number of modes (needs var as static doesn't work)
@ -262,8 +262,15 @@ class heatfan_cls
self.speed, max_speed) self.speed, max_speed)
tasmota.web_send_decimal(msg) tasmota.web_send_decimal(msg)
if webserver.has_arg("m_group_rotate") if webserver.has_arg("m_group_copy")
# Rotate group topic power from off,1,2,3,4,5,6,off... # Send current mode to group topic
if 0 == self.mode
tasmota.cmd("Publish cmnd/heatfans/Power0 0")
else
tasmota.cmd(f"Publish cmnd/heatfans/Power{self.mode} 1")
end
elif webserver.has_arg("m_group_rotate")
# Rotate group topic mode from off,1,2,3,4,5,6,off...
if self.mode == self.mode_states if self.mode == self.mode_states
tasmota.cmd(f"Publish cmnd/heatfans/Power{self.mode_states} 0") tasmota.cmd(f"Publish cmnd/heatfans/Power{self.mode_states} 0")
else else
@ -273,7 +280,10 @@ class heatfan_cls
end end
def web_add_main_button() def web_add_main_button()
webserver.content_send("<p></p><button onclick='la(\"&m_group_rotate=1\");'>Rotate Group Modes</button>") webserver.content_send("<table style=\"width:100%\"><tr>")
webserver.content_send("<td style=\"width:50%\"><button onclick='la(\"&m_group_copy=1\");'>Copy Mode</button></td>")
webserver.content_send("<td style=\"width:50%\"><button onclick='la(\"&m_group_rotate=1\");'>Rotate Mode</button></td>")
webserver.content_send("</tr></table>")
webserver.content_send(f"<div style='text-align:right;font-size:11px;color:#aaa;'>HeatFan {self.version}</div>") webserver.content_send(f"<div style='text-align:right;font-size:11px;color:#aaa;'>HeatFan {self.version}</div>")
end end