Last active
January 21, 2022 15:41
-
-
Save HarHarLinks/e06363c4b61d6be2f0941193bacf1879 to your computer and use it in GitHub Desktop.
Tasmota BME280 + generic HT16K33 7 segment display cycle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is for a "DisplayMode 11" generic common anode 7 segment display such as the Adafruit one with HT16K33 | |
// Rule sets updates the display every 15 seconds on a cycle: | |
// 1. the 24h time, using DisplayMode 2. This has the advantage of animated blinking colon, and updating if necessary, but the drawback that the display blanks at the start of the cycle | |
// 2. the Temperature value from BME280 sensor formatted as `XX.Y°` a 2+1 digit float with degree sign. Mostly useful with Celsius scale, adapt to your needs. | |
// 3. the Humidity value from BME280 sensor formatted as `XX.YH` where H is the indicator that this is the humidity value, since the display can't render % | |
// 4. the Air Pressure value from BME280 sensor formatted as `XXXX` or `XXX.Y` depending on whether it's greater or less than 1000 | |
// The DisplayText [x4]r99 and DisplayText [x4]r118 are raw values setting the "fourth" digit of the display to the ° symbol/letter H as the driver doesn't support them | |
// Backlog0 is used since we need multiple DisplayText commands per value and want to execute them as simultaneously as possible | |
Rule1 | |
ON BME280#Temperature DO Backlog0 | |
var1 %value%; | |
ENDON | |
ON BME280#Humidity DO Backlog0 | |
var2 %value%; | |
ENDON | |
ON BME280#Pressure DO Backlog0 | |
var3 %value%; | |
ENDON | |
ON Time#Minute|1 DO Backlog0 | |
DisplayMode 2; | |
RuleTimer1 15; | |
RuleTimer2 30; | |
RuleTimer3 45; | |
ENDON | |
ON rules#timer=1 DO Backlog0 | |
DisplayMode 0; | |
DisplayText f%var1%0; | |
DisplayText [x4]r99; | |
ENDON | |
ON rules#timer=2 DO Backlog0 | |
DisplayText f%var2%0; | |
DisplayText [x4]r118; | |
ENDON | |
ON rules#timer=3 DO Backlog0 | |
DisplayText f%var3%; | |
ENDON | |
// Initialize display right away after boot | |
Rule2 | |
ON System#Boot DO | |
DisplayMode 2 | |
ENDON | |
// Activate rules | |
Rule1 1 // enable rule1 | |
Rule2 1 // enable rule2 | |
Rule2 5 // run only once |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment