-
Notifications
You must be signed in to change notification settings - Fork 130
Example voice command
ggodart edited this page Jan 11, 2021
·
3 revisions
# this only needs to be done during initialisation so wrap it in noloop
# noloop=start
$v_pool_control = new Voice_Cmd('{set, } pool control [on,off]');
# noloop=stop
A simple one-line handler
$pool_pump->set( $state, "pool voice control") if said $v_pool_control;
A more sophisticated handler
if ( $state = said $v_pool_control) {
$pool_pump->set( $state, "pool voice control");
print_log("pump turned $state by voice control";
}
run_voice_cmd("pool control on");
Thanks to Dustin Robinson to provide this sample code via the mailing list.