ha4us-scripts
ha4us-scripts is a Node.js based script runner for use in ha4us based smart home environments.
In the current version it is basically a copy of mqtt-scripts developed by Sebastian Raff aka hobbyquaker.
Needed methods in scripts
states
- set Setting a datapoint (emits mqtt XYZ/set/....)
- get observes the last status (options: timeout=1s, active:false - emits a get)
- getCached gets the last value from cache (sync, since it's only does a internal lookup)
- status - emits a status of current scriptDomain topic (optionally retained)
scheduler
Use cases
- turn on in the morning:
at ( 'sunset','06:30').subscribe(onNext(idx, _array of params__));
cron(' *')
License
MIT ©2017 Ulf Steinberg
MIT ©2015 Sebastian Raff
Functions
Adapter
- Adapter($log: any, $args: any, $states: StateService, $yaml: any, $objects: ObjectService): object
-
Parameters
-
$log: any
-
$args: any
-
$states: StateService
-
$yaml: any
-
$objects: ObjectService
Returns object
-
$onDestroy: $onDestroy
-
$onInit: $onInit
Object literals
Const ADAPTER_OPTIONS
ADAPTER_OPTIONS: object
imports
imports: string[] = ['$log', '$args', '$states', '$yaml', '$objects']
name
name: string = "scripts"
path
path: string = __dirname + '/..'
args
args: object
dir
dir: object
alias
alias: string = "dir"
demandOption
demandOption: boolean = false
describe
describe: string = "directory of script files"
type
type: string = "string"
lat
lat: object
alias
alias: string = "lat"
default
default: number = 54.46
demandOption
demandOption: boolean = false
describe
describe: string = "Latitude for sun calculation"
type
type: string = "number"
long
long: object
alias
alias: string = "long"
default
default: number = 9.95
demandOption
demandOption: boolean = false
describe
describe: string = "Longitutde for sun calculation"
type
type: string = "number"
times
times: object
alias
alias: string = "times"
default
default: string = ""
demandOption
demandOption: boolean = false
describe
describe: string = "List of custom times"
type
type: string = "string"
watch
watch: object
alias
alias: string = "w"
default
default: boolean = true
demandOption
demandOption: boolean = false
describe
describe: string = "watch for script file changes"
type
type: string = "boolean"