Example voice command - hollie/misterhouse GitHub Wiki
How to create a voice command
# 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
Create a handler for a voice command
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";
}
Running a voice command from user code;
run_voice_cmd("pool control on");
Thanks to Dustin Robinson to provide this sample code via the mailing list.