Kendziorra - simpleHomeSwitch
Last Arduino/ESP8266 project (click to open)

User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active
 

Article Index

simpleHomeSwitch command list

/** =========================================================================================== * A unit is a "function" on a Mesh Node. A Node can have more than one function. * A unit (setup function 1 commands) is saved in the Mesh Node database. * Automatic unit actions setup in function 2. Other, not unit, commands in function 3. * A functions has one or more commands. The "key" (four char fixed) always in data1 * (key: a unique key of four chars, unit: the function to control) * * Func 0 Cmd Descr data1, data2, data3, data4 * ============================================================================================ * #manual switch units# * --------------------- * 0 0 switch a unit key, [data2[,data3[,data4]] * a KaKu unit * data2: 0/1/2(OFF/ON/DIM) * [data3: 1-15] dim value(optional) * a D-Pin * data2: 0/1(OFF/ON) * a StepperSteps * data2: 0/1/2 (HOME/END/nn-steps) * 1:endSwitch or steps (512/4096 step mode:set by func 1, cmd 4) * 2:go to position data3-steps (position from HOME) * data3: nn-steps * a DegreesSteps * data2: 0/1/2 (HOME/DEGREES/nn-degrees) * 1:position set by func 1, cmd 5 * 2:go to position data3-degrees * data3: nn-degrees * 0 1 repeat last - key, (no parameters) * action * 0 2 get unit status key, (no parameters) Also usable to check if record exist * return - OFF/UP:0, ON/DOWN:1, and/or action value(s) * ---------------------------- * Func 1 Cmd Descr * ============================ * #setup a unit# If unit key exist then overwrite else add new * -------------- * 1 0 setup OLD KaKu: key, data2: code * data3: period * (NO additional signal options needed) * Use "simpleHomeSwitch\examples\KaKu-Receive.ino" * to get this two values * OLD KaKu: Use only the remote control ON-buttons * ======== ========== * to get the right "code"! * 1 1 setup1 NEW KaKu: key, data2: period * data3: address * data4: groupBit * finish this setup with function 1, command 2 * Use "simpleHomeSwitch\examples\KaKu-Receive.ino" * to get this six values * 1 2 setup2 NEW KaKu: key, data2: unit * data3: dimLevelPresent * data4: dimLevel * 1 3 setup PIN unit: key, Two pins mode (very useful to bridge remote * control buttons) (notation: D0, D1, D...) * data2: Pin1(ON/DOWD), momentary or hold * data3: Pin2(OFF/UP)), momentary or hold * One pin mode * data2: Pin(ON or OFF), * data3: -1 * 1 4 setup Stepper key, data2: 0/1(360* in 512/4096 steps mode) * data3: 0/nn-steps (set the ON action state) * (0:endSwitch or nn-steps:goto nn-steps) * 1 5 setup Degrees key, data2: degrees 1-259* (set the ON action state) * Now you can use this unit(s) with "function 0, command 0, key, option list" or ad * a "mode" and other parameters (Function 2 commands) * ---------------------------- * Func 2 Cmd Descr * ============================ * #setup unit mode# * ----------------- * 2 0 mode: key, data2: mode (0-10) * 0:Manual, 1:Time, 2:Lux, 3:Temp, 4:sunRise, 5:sunSet, * 6:Sun, 7:Day, 8:Night, 9:Timer, 10:TimeTemp * mode 6: use Lux + Temp + bad weather (sun screen mode) * mode 7: use sunrise + time offset, * mode 8: use sunSet + time offset * 2 1 time: key, data2: hh1:mm1 * data3: hh2:mm2 * time hh1:mm1(ON), time hh2:mm2(OFF) * (mode 1, 4, 10: hh1:mm1, mode 1, 5, 10: hh2:mm2) * 2 2 timer: key, data2: minutes * manual ON, OFF after n-minutes * 2 3 lux: key, data2: lux1(ON) * data3: lux2(OFF) * light intensity in lux, mode: 2, 6 * 2 4 temp: key, data2: temp1(ON) * data3: temp2(OFF) * temperature in nn.n°C/°F, mode: 3, 6, 10 * 2 5 offset key, data2: minutes1 * data3: minutes2 * after sunRise, before sunSet (minutes) * (mode: 4, 7, 8(minutes1), 5, 7, 8(minutes2)) * positive or negative values are valid * 2 6 yoyo: key, data2: minutes * minutes to prevent a yo-yo effect (mode: 6) * 2 7 repetitions: key, data2: repetitions * data3: millis * number of repetitions, length in Millis (mode: 6) * 2 8 bad weather key, data2: lux * lux, quick dark (bad weather) (mode: 6) * 2 9 stop: key, data2: 0/1/2 * 0:Active * 1:Pause, 04:00am reset * 2:Stop, wait for revoked (mode: all) * 2 10 reverse: key, data2: 0/1 * 0:normal * 1:reverse the unit (ON<->OFF) (mode: all) * 2 11 delete: key, (noting) * tombstone the unit (use func:3, cmd:99 to compressDB) * ---------------------------- * ###################################### * Other, not unit, commands and function * ###################################### * ---------------------------- * Func 3 Cmd Descr * ============================ * #Sync the Time?# * ---------------- * 3 0 Nodes can ask a UTC/GMT UNIX timestamp from Node(nn) * ask NodeWS or a Node with a RTC or all "99" * also usable to check the time with a Web Browser * ---------------------------- * #Time set# * ----------------- * 3 1 time set in seconds as UTC/GMT UNIX timestamp * data1: 10 digits (uint32_t) * not usable with NTP and WEB time * usable with RTC (and Timelib if no askTime sync) * ---------------------------- * #Time correction# * ----------------- * 3 2 time correction in -/+ seconds * data1: -32767 to 32767 (int16_t) * usable with RTC and Timelib * not usable with NTP and WEB time * usable with RTC (and Timelib if no askTime sync) * ---------------------------- * #get Temp and Lux# * ------------------ * 3 3 Nodes /Web Browser can ask the Temp and Lux from a Node * ---------------------------- * #get Analog values# * ------------------- * 3 4 Nodes /Web Browser can ask ADC values from a Node with A-pin or HiRes ADS1115 port * very useful in a (Web Browser-)App (use Google Charts) * data1:A-pin (notation: A0, A1, ...) or ADS1115 port (A0-A15) * data2: 0-3 (ask for ..., values are set in data3-4) * 0:volt and steps (volt, ADC value) * 1:voltStep and maxSteps (volt resolution, max resolution) * 2:temp and ohm (if using a thermistor) * ---------------------------- * #get/set Digital value# * ----------------------- * 3 5 Nodes /Web Browser can ask/set digital values from a Node * data1:D-pin (notation: D0, D1, ...) * data2: 0:getPin, 1:setPin, 2:set pinMode * data3:setPin (0/1 - LOW/HIGH) * pinMode (0/1/2 - INPUT/OUTPUT/INPUT_PULLUP) * ---------------------------- * #get sunRise/Set times * ----------------------- * 3 6 Nodes /Web Browser can ask sun rise/set times * rise hh:mm to data1 * set hh:mm to data2 * DST to data3 * ---------------------------- * #add your own ask functions# * ---------------------------- * 3 ? (??? in doFunc.ino->void function3()) * ---------------------------- * #DB backup and compress# * ------------------------ * 3 99 backup the database and then compress it (remove tombstone records) * ---------------------------- **/