plugin VoiceReceiver

User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

plugin VoiceReceiver

Post by kw123 »

=========================================================
#########################################################################
credit must go to @dtich on the indigo forum who came up with the script
#########################################################################

current release is v 2022.4.3
https://github.com/kw123/VoiceReceiver/releases

What does it do?
the PLUGIN
- receives message in indigo variable from iphone dictation shortcut
- analyses the received string to look for commands to
-- start indigo actions (must be defined in plugin menu)
-- switch on/off or dim devices set variables, etc
- sends back ok / not sucessful (you can set) and the iphone speaks that text
- in menu you can define / do :
1. synonymes for devices, variables, actions
2. mappings of bad to good words (eg "hugh" to "hue" or "the bug" to "debug") the plugin will replace the bad strings with the good
3. block words eg if "alarm" is set as blocked word any command containing "alarm" will be ignored
4. print help / config and stats ( how often and when was a command received) to logfile

the SHORTCUT on the iphone / mac / ipad /..
- listens to commands or has a command hardwired into code
- sends command into indigo variable ".. command .."
- receives result from variable ".. feedback .."
- speaks result (ok / not successful) depening on settings

================================ INSTALL ===========================

(A) After plugin install define the configurations in plugin config and menu, see below
in config define
variable and folder names
(language) mappings for on/off turn .. to other languages if you like
eg on -> an or set --> write
in menu define
- synonymes for actions, devices, variables:
to be used: eg use "open garage" instead of "garage door open relay"
- mappings of bad to good words: eg "hugh" to "hue" or "the bug" to "debug"; the plugin will replace the bad strings with the good
- block words: eg if "alarm" is set as blocked word any command containing "alarm" will be ignored

(B) === Create shortcut on iPhone with the following items: ====
you can download a shortcut with empty keys etc athttps://www.icloud.com/shortcuts/467123 ... 3589cf6579
then replace the <xxx> with your variable ids, ip numbers users bearer ... etc


speaking "hey Siri Indigo" pause "turn on office lights"
you could also define eg "hey indigo do" as hey siri replacement for this shortcut:
settings / Accessibility / vocal short cuts / add action / select yor shorcut say "hey indigo do" 3 times save
if you have a light named office lights:
"hey indigo do" pause "turn on office lights" should turn on your office lights
siri sometimes does not produce a "1" but "one" two etc
the plugin will replace null / zero ... twelve to 0,1,2,3,.. 12
also for german, french, spanish - if you need another language, let me know - we could also do dialects ;)

Code: Select all

==== [b] commands[/b] ====================================================
   substitute <device>   with device name     or synonym or  "device id:<devId>:"     or "deviceid:<devId>:" 
   substitute <variable> with variable name   or synonym or  "variable id:<varId>:"   or "variableid:<varId>" 
   substitute <action>   with action synonym  or             "action id:<actionId>:"  or "actionid:<actionId>"
   substitute <state>    with state name  
   substitute <value>    with value to be used 
   upper and lower cases are ignored
   To make find dev anmes etc easier : 
     commands  and names received will be "normalized:" 
        "_"  and "-" "?" "."  will be replaced by " " 
     indigo device and variable names and state names will be normalized:" 
        "abcDef"  will be replaced by "abc def"  
        "_"  and "-"  will be replaced by " " 
   then incoming and indigo names etc can be better compared
   
 commands: 
   set variable <variable> to value                                      write value to variable, must contain "to"  
   get variable <variable>                                               get var value and speak it
   get <device> state <state>                                            get dev/state value and speak it
                                                                         notice the differnce to get variable 
   (set) speed <device> (to) xx                                          for fans; (0-4 or 100)  one, two are mapped to 1, 2
   beep <device>  
   lock <device>  
   unlock <device>  
   turn on/off <device>                                              
   turn  <device> on/off                                             
   toggle <device>                                                   
   pulse <device> <secs>  (seconds)                                      on for <secs>  then off, default = 1 secs     
   dip <device> <secs>  (seconds)                                        off for <secs> then on,  default = 1 secs     
   (set) heat (temperature) <device> to <degrees> (temperature, degrees) for thermostates to set heat target temp 
   (set) cool (temperature) <device> to <degrees> (temperature, degrees) for thermostatesto seth ac target temp
   (set) bright(ness level) <device> (to) <value> (percent / %)          will set brightess of dimmer device to <value> 0..100  
   " and "  or  "&""  or  " then "                                       can be used to concatenate several commands"

=== meta commands ==================================================
  list devices                                                       will print xx # of devices to logfile;  just to show 
  debug on                                                           will enable debug all 
  debug off                                                          will disable debug all 
  test                                                               will print "test" to logfile 
  help                                                               will print ALL THIS to logfile 

Code: Select all

[b]Examples [/b]for commands:
   turn on office lights                                             will turn on office lights and the phone will speak "ok" or "turned on" depending on settings 
   turn office lights on                                             will turn on office lights and the phone will speak "ok" or "turned on" depending on settings 
   turn off deviceid:12345:                                          will turn on indigo device with id 12345 
   toggle deviceid:12345:                                            will toggle indigo device with id 12345 
   pulse deviceid:12345: 5 sec                                       will turn on indigo device with id 12345 for 5 secs then off
   dip office lights                                                 will turn off indigo device  "office lights" for 1 secs then on - 1 is the default
   open garage                                                       will be execute that action if you have defined "open garage" as a synonym for an action
   actionid:54321                                                    will execute indigo action with id 54321 if it exists
   bright <device1> to xx and wait 5 and turn on <device2>           will execute 3 commands  
   turn on ;SKD;ASJ  on                                              will fail and the iphone will speak "not executed" or "device not found" depending on settings 
menu print config

Code: Select all

plugin config Parameters ===========
allow_delta_time        = 3.0
                           message must not be older thn current timestamp +  allow_delta_time

expect_time_tag         = True
                           require time stamp value as first work in message
var_name                = voice_command_text
                           name of the variable the plugin will listen to, will be created if it does not exist

var_name_feedback       = voice_command_feedback
                           name of the variable the plugin will write result to be pickup by iphone, will be created if it does not exist
folder_name             = voiceReceiver
                           folder name of the variables, will be created if it does not exist

list devices max        = 50
                           list max number of devices when receiving command list devices

return feedback         = detailed
                           return what to iphone  "blank" or "ok/not executed" or detailed info

return strings if successful ============================ if return feedback = detailed
                            set             -> set 
                            get             ->  
                            bright          -> brightness set 
                            toggle          -> toggled 
                            pulse           -> pulsed 
                            dip             -> dipped 
                            turn            -> turned  on off 
                            speed           -> speed set 
                            beep            -> beeped 
                            cool            -> cool set 
                            heat            -> heat set 
                            lock            -> locked 
                            unlock          -> unlocked 
                            silence         -> silence set 
                            wait            -> waited 
command word mapping       ===============================
                            set             -> set 
                            get             -> get 
                            to              -> to 
                            of              -> of 
                            level           -> level 
                            bright          -> bright 
                            toggle          -> toggle 
                            pulse           -> pulse 
                            dip             -> dip 
                            turn            -> turn 
                            on              -> on 
                            off             -> off 
                            speed           -> speed 
                            beep            -> beep 
                            cool            -> cool 
                            heat            -> heat 
                            lock            -> lock 
                            unlock          -> unlock 
                            silence         -> silence 
                            variable        -> variable 
                            wait            -> wait 
Defined synonymes for actions:       =============================== 
     voice phrase         --> action id = indigo name ------------
     open garage             1576588508 = open garage door
     press button             449021673 = write to log button pressed
     stop curtain             463950535 = press stop curtain family room 

Defined synonymes for devices:       ===============================
     voice phrase         --> device id = indigo name ------------
     left one                  20740376 = Actuator  Links-001B9F29B52333;

Defined synonymes for variables:     ===============================
     voice phrase       --> variable id = indigo name ------------
     cpu usage                905248318 = CPU_usage_ActionCollection
 
blocked_words           = ['alarm', 'lock']
                           words that are not allowed for devices and actions eg "alarm", when they are present the whole command is ignored

bad to good words:          bad                good
                            cour            -> color 
                            de back         -> debug 
                            de back off     -> debug off 
                            hieu            -> hue 
                            hugh            -> hue 
                            the bag         -> debug 
                            the block       -> debug 
                           bad phrases to be replaced by good phrases 

=============================


with dictation enabled
Screenshot 2026-06-03 at 11.42.08.png
Screenshot 2026-06-03 at 11.42.08.png (108.04 KiB) Viewed 180 times
with hardwired command
Screenshot 2026-06-03 at 11.35.06.png
Screenshot 2026-06-03 at 11.35.06.png (171.82 KiB) Viewed 180 times
Screenshot 2026-06-03 at 11.35.25.png
Screenshot 2026-06-03 at 11.35.25.png (66.69 KiB) Viewed 180 times
Screenshot 2026-06-03 at 11.36.03.png
Screenshot 2026-06-03 at 11.36.03.png (124.14 KiB) Viewed 180 times
Screenshot 2026-06-03 at 11.36.24.png
Screenshot 2026-06-03 at 11.36.24.png (124.47 KiB) Viewed 180 times
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: plugin VoiceReceiver

Post by kw123 »

first non beta release at

Code: Select all

https://github.com/kw123/VoiceReceiver
User avatar
durosity
Posts: 4810
Joined: Thu May 10, 2012 3:21 pm
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: plugin VoiceReceiver

Post by durosity »

Nice work!
Computer says no.
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

plugin VoiceReceiver

Post by kw123 »

And on the iPhone you can setup
Accessibility
Vocal short cuts
Add action
Select „Indigo“ if that’s your shortcuts name
Say Indigo 3 times .. save..

Then when iPhone is asleep you can say:
„Indigo“ pause „turn on office lights“
And you get „ok“ answered when finished

= you can skip hey siri

And you can make the shortcut name longer eg „hey indigo do“ do make it less „triggery“


Sent from my iPhone using Tapatalk
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: plugin VoiceReceiver

Post by kw123 »

Future plans:

Add
silent response = no ok not successful
Response : not just ok.. but eg for turn on: turned on ( you can set response phrases)
fan on/off high /med/low
Set variable name to
Get value of state/ variable spoken on iPhone

Any other suggestions ?


Sent from my iPhone using Tapatalk
dtich
Posts: 897
Joined: Sat Sep 24, 2005 10:32 pm

Re: plugin VoiceReceiver

Post by dtich »

excellent Karl!
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: plugin VoiceReceiver

Post by kw123 »

changes in V2022.2.1 2025-12-26
==================

added several functions:
- silence
- set var value
- get var value
- get dev / state value
- beep device
- unlock device
- lock device
- set speed of fan

posted on GitHub see first post
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: plugin VoiceReceiver

Post by kw123 »

The next steps are to make the voice dictation on the iPhone better.

It’s a little sensitive on pause between hey… and the command and how long it is listening to

Happy to discuss with someone who wants to test.


Sent from my iPhone using Tapatalk
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: plugin VoiceReceiver

Post by kw123 »

changes in V2022.2.2 2025-12-26
==================

-bug fixes

-added stats on failed commands, print to log from menu
ie when iPhone command is NOT recognized: printout looks like:
failed commands "received command": [count, last time]
The log:[1, '2025-12-27 23:08:53']
Be back on:[2, '2025-12-27 23:09:09']
hence might use "be back on" -> "debug on" in map phrases


download is on GitHub, see first post
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: plugin VoiceReceiver

Post by kw123 »

changes in V22022.3.3 2026-01-04
==================

1. added various explanations to help / config etc.
2. added option to use "deviceid:12345:" instead of device/variable/action names..
3. added detailed feedback option to be spoken on iphone after execution
4. added abcDEF -> abc def mapping in addition to "_" -> " " to be able to match incoming dev names to existing indigo dev names
5. added get variable dev / state contents to be spoken on iphone
6. will replace "one" with 1 .. received from iphone used to set temp speed etc
the iphone sometime produces "one" "two" instead for 1 2 after listening
7. various smaller changes and fixes
8. updated the downloadable shortcut

this should be production ready now
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: plugin VoiceReceiver

Post by kw123 »

changes in V22022.4.3 2026-01-07
==================

1. added command dip == inverse of pulse = turn off for x secs hen turn on.
2. added options to use variations of commands
3. more robust parsing of commands ie find numbers in command
set brightness level device name to xx percent
will do a search backwards to find the xx number and remove other decorative words like percent, to level etc , reduced to
device name xx
4. added a short delay before the shortcut get the response from the plug to make sure the plugin is finished with execution of command


see first post for the complete description and download links for plugin and shortcut


Karl
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: plugin VoiceReceiver

Post by kw123 »

1. added "straight (plain) action command": when enabled in config ("enable straight action command"),
speak the exact name of an indigo action group to run it directly, no synonym needed.
tries to match the exact name first, then a normalized compare ignoring case, spaces and "/".


see also readme at GitHub https://github.com/kw123/VoiceReceiver
or indigo plugin downloads https://www.indigodomo.com/pluginstore/316/

an advantage of this method is that it will be using a direct connection to the indigo server when you are at home (in your wifi) and does not go through the internet to indigo host and then back to your home.
my experience this is > 1 sec faster.

updated the screen shots
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: plugin VoiceReceiver

Post by kw123 »

changes in V2022.4.7 2026-07-07
==================

bug-fix audit (~25 fixes):
1. number-word map: "eleven" had an embedded tab (never matched), "twelve" mapped to 11,
spanish "cero" mapped to 1 (now 0), added missing "uno":1
2. allow_delta_time was divided by 10 when read from prefs (30s window became 3s);
saving the config dialog always failed with a TypeError (str * float) - both fixed
3. list_devices_max read as string -> TypeError when comparing in "list devices"
4. "silence" command crashed (undefined cmdLower); silence on/off logic rewritten:
on = mute feedback, off = restore configured feedback mode
5. set variable by name crashed (undefined level/value in both branches)
6. set variable / get variable with "variable id:<id> value" (missing 2nd colon)
crashed on typo indigo.variales (2x)
7. "get <device> state <state>" by device name never worked (dead code path);
also reported wrong feedback texts ("variable not found", success on missing state)
8. map_to_float fallback crashed (map_to_int missing self.) -> "wait five" etc. failed
9. strip_words removed characters instead of whole words (could eat device-name ends,
e.g. "office" -> "offi")
10. turn on/off with deviceid: compared literal "on"/"off" against translated words ->
wrong direction in non-english configs
11. variableid:... was never normalized to "variable id:" (mapping was a no-op)
12. "action id:" with trailing text crashed on int() parse; "acton not present" typo
13. handle_unlock logged undefined result; handle_set_speed logged undefined theName
(both crashed the handler when debug logging was on)
14. debug areas "ReceivdeData" typo -> receive-data debug logging never appeared
15. "debug off" fell through and was re-processed as a device command (missing return)
16. check_if_float spammed the indigo event log on every parse (leftover debug print)
17. set_feedback_value_ok referenced undefined self.return_ok (dead branch removed)
18. remove_firstword crashed on empty string; openEncoding error log malformed;
"not finshed"/"state not defned" typos; removed unused import copy
Post Reply

Return to “VoiceReceiver”