Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
-- -- Domoticz passes information to scripts through a number of global tables -- -- otherdevices, otherdevices_lastupdate and otherdevices_svalues are arrays for all devices: -- otherdevices['yourotherdevicename'] = "On" -- otherdevices_lastupdate['yourotherdevicename'] = "2015-12-27 14:26:40" -- otherdevices_svalues['yourotherthermometer'] = string of svalues -- -- uservariables and uservariables_lastupdate are arrays for all user variables: -- uservariables['yourvariablename'] = 'Test Value' -- uservariables_lastupdate['yourvariablename'] = '2015-12-27 11:19:22' -- -- other useful details are contained in the timeofday table -- timeofday['Nighttime'] = true or false -- timeofday['SunriseInMinutes'] = number -- timeofday['Daytime'] = true or false -- timeofday['SunsetInMinutes'] = number -- globalvariables['Security'] = 'Disarmed', 'Armed Home' or 'Armed Away' -- -- To see examples of commands see: http://www.domoticz.com/wiki/LUA_commands#General -- To get a list of available values see: http://www.domoticz.com/wiki/LUA_commands#Function_to_dump_all_variables_supplied_to_the_script -- -- Based on your logic, fill the commandArray with device commands. Device name is case sensitive. -- print ("Time based event fired"); -- loop through all the devices for deviceName,deviceValue in pairs(otherdevices) do -- if (deviceName=='myDevice') then -- if deviceValue == "On" then -- print("Device is On") -- elseif deviceValue == "Off" then -- commandArray['a device name'] = "On" -- commandArray['Scene:MyScene'] = "Off" -- end -- end end -- loop through all the variables for variableName,variableValue in pairs(uservariables) do -- if (variableName=='myVariable') then -- if variableValue == 1 then -- commandArray['a device name'] = "On" -- commandArray['Group:My Group'] = "Off AFTER 30" -- end -- end end function timebetween(s,e) timenow = os.date("*t") year = timenow.year month = timenow.month day = timenow.day s = s .. ":00" -- add seconds in case only hh:mm is supplied e = e .. ":00" shour = string.sub(s, 1, 2) sminutes = string.sub(s, 4, 5) sseconds = string.sub(s, 7, 8) ehour = string.sub(e, 1, 2) eminutes = string.sub(e, 4, 5) eseconds = string.sub(e, 7, 8) t1 = os.time() t2 = os.time{year=year, month=month, day=day, hour=shour, min=sminutes, sec=sseconds} t3 = os.time{year=year, month=month, day=day, hour=ehour, min=eminutes, sec=eseconds} sdifference = os.difftime (t1, t2) edifference = os.difftime (t1, t3) isbetween = false if sdifference >= 0 and edifference <= 0 then isbetween = true end print(" s:" .. s .. " e:" .. e .. " sdifference:" .. sdifference.. " edifference:" .. edifference) return isbetween end commandArray = {} -- w nocy tryb nocny, w dzień tryb auto if (uservariables["airpower"] == 1 and uservariables["silent"] == 0 and uservariables["airauto"] == 1 and timebetween("00:00:00","05:59:00")) then commandArray['Oczyszczacz - Source']='Set Level: 10' --Silent (Tryb nocny) commandArray['Variable:noc']='1' commandArray['Variable:ON_25.75']='0' commandArray['Variable:ON_10.25']='0' print ("Oczyszczacz - tryb nocny") elseif (uservariables["airpower"] == 1 and uservariables["idle"] == 0 and uservariables["airauto"] == 1 and uservariables["ON_25.75"] == 0 and uservariables["ON_10.25"] == 0 and timebetween("06:00:00","22:00:00")) then commandArray['Oczyszczacz - Source']='Set Level: 30' --Idle (Tryb automatyczny) commandArray['Variable:noc']='0' print ("Oczyszczacz - tryb auto") elseif (uservariables["airpower"] == 1 and uservariables["silent"] == 0 and uservariables["airauto"] == 1 and timebetween("22:01:00","23:59:00")) then commandArray['Oczyszczacz - Source']='Set Level: 10' --Silent (Tryb nocny) commandArray['Variable:noc']='1' commandArray['Variable:ON_25.75']='0' commandArray['Variable:ON_10.25']='0' print ("Oczyszczacz - tryb nocny") end --wyłączenie i włączenie oczyczacza w zależności od stanu powietrza if (uservariables["airpower"] == 1 and uservariables["airauto"] == 1 and uservariables["dobrepowietrze"] == 1) then commandArray['Oczyszczacz - Power']='Off' print ("Dobre powietrze - oczyszczacz wyłączony") commandArray['Variable:silent']='0' commandArray['Variable:idle']='0' commandArray['Variable:favorite']='0' elseif (uservariables["airauto"] == 1 and uservariables["dobrepowietrze"] == 0 and uservariables["airpower"] == 0) then commandArray['Oczyszczacz - Power']='On' print ("Słabe powietrze - oczyszczacz włączony") end --od 25 do 75 pm 2.5 tryb favorite 2 (poza tym zakresem tryb auto) if (uservariables["airpower"] == 1 and uservariables["airauto"] == 1 and uservariables["noc"] == 0 and uservariables["25.75"] == 1 and uservariables["ON_25.75"] == 0 and uservariables["10.25"] == 0) then commandArray['Oczyszczacz - Source']='Set Level: 20' --Favorite (Tryb ulubiony) commandArray['Oczyszczacz - Fan Favorite level']='Set Level 14' --Wybór favorite 2 commandArray['Variable:ON_25.75']='1' print ("Oczyszczacz - tryb favorite 2 włączony (pm 2.5 od 25 do 75)") elseif (uservariables["airpower"] == 1 and uservariables["airauto"] == 1 and uservariables["noc"] == 0 and uservariables["25.75"] == 0) then commandArray['Variable:ON_25.75']='0' print ("Oczyszczacz - tryb favorite 2 wyłączony (pm 2.5 różne od 25 do 75)") end --od 10 do 25 pm 2.5 tryb favorite 1 (poza tym zakresem tryb auto) if (uservariables["airpower"] == 1 and uservariables["airauto"] == 1 and uservariables["noc"] == 0 and uservariables["10.25"] == 1 and uservariables["ON_10.25"] == 0 and uservariables["25.75"] == 0) then commandArray['Oczyszczacz - Source']='Set Level: 20' --Favorite (Tryb ulubiony) commandArray['Oczyszczacz - Fan Favorite level']='Set Level 7' --Wybór favorite 1 commandArray['Variable:ON_10.25']='1' print ("Oczyszczacz - tryb favorite 1 włączony (pm 2.5 od 10 do 25)") elseif (uservariables["airpower"] == 1 and uservariables["airauto"] == 1 and uservariables["noc"] == 0 and uservariables["10.25"] == 0) then commandArray['Variable:ON_10.25']='0' print ("Oczyszczacz - tryb favorite 1 wyłączony (pm 2.5 różne od 10 do 25)") end return commandArray
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
Cooking Recipe
16 min ago | 6.19 KB
Cooking Recipe
18 min ago | 6.20 KB
Cooking Recipe
21 min ago | 6.18 KB
⭐ Exploit Documentation ⭐
CSS | 53 min ago | 1.04 KB
This month smells like money
CSS | 53 min ago | 1.04 KB
✅ API Flaw Money Method
CSS | 53 min ago | 1.04 KB
Cooking Recipe
1 hour ago | 6.11 KB
Cooking Recipe
2 hours ago | 6.10 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!