From 8ec9a7a7cb9983b1245e27f0f73b725dd1a657b1 Mon Sep 17 00:00:00 2001 From: Michael Ingraham <34340210+meingraham@users.noreply.github.com> Date: Sat, 24 Aug 2019 09:01:53 -0400 Subject: [PATCH] Updated Script Cookbook (markdown) --- Script-Cookbook.md | 78 +++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/Script-Cookbook.md b/Script-Cookbook.md index d244e2af..73fec4c3 100644 --- a/Script-Cookbook.md +++ b/Script-Cookbook.md @@ -1,8 +1,8 @@ - [Scripting Language Example](#Scripting-Language-Example) - [Sensor Logging](#Sensor-Logging) -- [ePaper 29 Display with SGP30 and BME280](#ePaper-29-Display-with-SGP30-and-BME280) -- [ePaper 42 Display with SHT31 and BME280](#ePaper-42-Display-with-SHT31-and-BME280) +- [e-Paper 29 Display with SGP30 and BME280](#e-Paper-29-Display-with-SGP30-and-BME280) +- [e-Paper 42 Display with SHT31 and BME280](#e-Paper-42-Display-with-SHT31-and-BME280) - [ILI 9488 Color LCD Display with BMP280 and VL5310X](#ILI-9488-Color-LCD-Display-with-BMP280-and-VL5310X) - [LED Bar Display with WS2812 LED Chain](#LED-Bar-Display-with-WS2812-LED-Chain) - [Multiple IR Receiver Synchronization](#Multiple-IR-Receiver-Synchronization) @@ -191,7 +191,7 @@ if upsecs%60==0 then ahum/=tcnt atemp/=tcnt -=>Websend [184.106.153.149:80]/update?key=PYUZMVWCICBW492&field1=%atemp%&field2=%ahum% +=>WebSend [_IP_]/update?key=PYUZMVWCICBW492&field1=%atemp%&field2=%ahum% tcnt=0 atemp=0 ahum=0 @@ -352,9 +352,8 @@ endif ------------------------------------------------------------------------------ -#### ePaper 29 Display with SGP30 and BME280 -Some vars are set from iobroker -DisplayText substituted to save script space +#### e-Paper 29 Display with SGP30 and BME280 +Some variables are set from ioBroker >**>D** hum=0 @@ -370,6 +369,7 @@ wr3=0 otmp=0 pwl=0 tmp=0 +; DisplayText substituted to save script space DT="DisplayText" ; preset units in case they are not available punit="hPa" @@ -382,7 +382,7 @@ tunit="C" =>%DT% [x0y20h296x0y40h296] >**>T** -; get tele vars +; get telemetry sensor values temp=BME280#Temperature hum=BME280#Humidity press=BME280#Pressure @@ -393,7 +393,7 @@ tunit=TempUnit punit=PressureUnit >**>S** -// update display every teleperiod time +// update display every [`TelePeriod`](Commands#teleperiod) if upsecs%tper==0 then dp2 @@ -422,14 +422,13 @@ endif ------------------------------------------------------------------------------ -#### ePaper 42 Display with SHT31 and BME280 -this script shows 2 graphs some local sensors, and a power statistics on an 4.2 inch epaper -the first graph is the battery level of a solar battery (tesla powerwall 2) -the second shows the solar yield in watts of the roof panels -also special is the display of daily and weekly averages (via moving average) of all power IO of the house. -as the display is a full update panel it is updated only once a minute -some values (like power meters) are set remotely from iobroker - +#### e-Paper 42 Display with SHT31 and BME280 +This script shows 2 graphs on an 4.2 inch e-Paper display: 1. some local sensors, and 2. power statistics +- The first graph is the battery level of a solar battery (Tesla PowerWall 2) +- The second graph shows the solar yield of the roof panels in Watts +- Another special feature is that this script displays daily and weekly averages (via moving average) of all power IO of the house. +- Since the display is a full update panel it is updated only once a minute +- Some values (like power meters) are set remotely from ioBroker >**>D** hum=0 @@ -450,9 +449,10 @@ M:mezh=0 7 vzh=0 svzh=0 M:mvzh=0 7 - +> >hr=0 t1=0 +; DisplayText substituted to save script space DT="DisplayText" >**>B** @@ -483,19 +483,19 @@ dp0 =>%DT% [p5x360y75]%pwl% %% =>%DT% [p6x360y180]%wr1%W =>%DT% [g0:%pwl%g1:%wr1%] - +> >=>%DT% [p24x75y230] %wr1% W : %-wr2% W : %-wr3% W =>%DT% [p-10x75y245]%ezh% kWh =>%DT% [p-10x75y260]%vzh% kWh =>%DT% [p-10x75y275]%ez1% kWh - +> >t1=mezh*7 =>%DT% [p-10x150y245]: %t1% kWh t1=mvzh*7 =>%DT% [p-10x150y260]: %t1% kWh t1=mez1*7 =>%DT% [p-10x150y275]: %t1% kWh - +> >dp1 t1=ezh-sezh =>%DT% [p12x250y245]: %t1% kWh @@ -503,13 +503,13 @@ t1=vzh-svzh =>%DT% [p12x250y260]: %t1% kWh t1=ez1-sez1 =>%DT% [p12x250y275]: %t1% kWh - +> >dp0 =>%DT% [f2p5x320y250] %otmp%C - +> >=>%DT% [d] endif - +> >hr=hours if chg[hr]>0 and hr==0 @@ -521,7 +521,7 @@ sezh=ezh mvzh=vzh-svzh svzh=vzh endif - +> >if sezh==0 then sez1=ez1 @@ -534,10 +534,10 @@ endif ------------------------------------------------------------------------------ #### ILI 9488 Color LCD Display with BMP280 and VL5310X -Shows various energy graphs -display switches on and off with proximity sensor +Shows various BMP280 energy graphs +Turn display on and off using VL5310X proximity sensor to prevent burn-in -some vars are set from iobroker +Some variables are set from ioBroker >**>D** temp=0 @@ -550,6 +550,7 @@ otmp=0 pwl=0 tmp=0 dist=0 +; DisplayText substituted to save script space DT="DisplayText" punit="hPa" tunit="C" @@ -567,15 +568,14 @@ hour=0 =>mp3track 4 >**>T** -; get some tele vars +; get some telemetry values temp=BMP280#Temperature press=BMP280#Pressure tunit=TempUnit punit=PressureUnit dist=VL53L0X#Distance > ->; check proximity sensor to switch display on/off -; to prevent burn in +>; check proximity sensor to turn display on and off to prevent burn-in if dist>300 then if pwr[2]>0 @@ -628,7 +628,7 @@ endif ------------------------------------------------------------------------------ #### LED Bar Display with WS2812 LED Chain -Used as display for solar house power input/output (+-5000 Watts) +Used to display home's solar power input/output (+-5000 Watts) >**>D** m:array=0 60 ;defines array for 60 led pixels @@ -733,14 +733,14 @@ next ------------------------------------------------------------------------------ #### Multiple IR Receiver Synchronization -Since I own a magic home with IR receiver I made a script to show how it works -I have 2 magic home devices that should be synchronized so I send the commands also to a second magic home via websend +Shows how a Magic Home with IR receiver works +Synchronizes 2 Magic Home devices by also sending the commands to a second Magic Home via [`WebSend`](Commands#websend) **Script example using `if then else`** ->; define (expand string section to 25 chars) +>; expand default string length to be able to hold `WebSend [xxx.xxx.xxx.xxx]` **>D 25** istr="" -ws="websend [192.168.178.84]" +ws="WebSend [_IP_]" >; event section **>E** @@ -806,10 +806,10 @@ endif >istr="" **Script example using `switch case ends`** ->; define (expand string section to 25 chars) +>; expand default string length to be able to hold `WebSend [xxx.xxx.xxx.xxx]` **>D** 25 istr="" -ws="websend [192.168.178.84]" +ws="WebSend [_IP_]" >; event section **>E** @@ -866,10 +866,10 @@ ends #### Fast Polling ->; expand strings to hold websend +>; expand default string length to be able to hold `WebSend [xxx.xxx.xxx.xxx]` **>D 25** sw=0 -ws="websend [192.168.178.86]" +ws="WebSend [_IP_]" timer=0 hold=0 toggle=0