Skip to content

substitutions

DaveL17 edited this page Dec 28, 2023 · 16 revisions

There are several helpful examples of substitution syntax available in the Announcements Device dialog. The complete list of modifiers is described here.

The full construction of an announcement substitution when using the plugin's built-in modifiers is:
<<*something to modify*, *modifier*>>

A complete, complex announcement might look something like this:
%%d:24058256:intro%%. It's <<%%v:1289138982%%, dt:%A>> at <<now, ct:%-I:%M%p>>. The current temperature is <<%%d:1149686816:temp%%, n:0>> degrees.

This announcement constructor would result in something like:
"Good afternoon. It's Tuesday at 3:24 pm. The current temperature is 42 degrees."

The tables below show each type of announcement modifier and the resulting announcement that will be spoken.

Current Time [ct:#]
<<now, ct:%-I:%M%p>> "One Fifty Five PM"
<<now, ct:%A>> "Wednesday"

Note

The plugin should be able to support all standard Python datetime specifiers.

Note

The term 'now' only works with the Current Time [ct:] modifier.

Datetime [dt:#]
<<2018-01-01 12:34:56.123456, dt:%H:%M>> "Twelve Thirty Four"
<<%%d:12345678:state%%, dt:%H:%M>> "Twelve Thirty Four"
<<%%v:12345678%%, dt:%H:%M>> "Twelve Thirty Four"

Note

The plugin should be able to support all standard Python datetime specifiers.

Note

The term 'now' does not work with the Datetime [dt:] modifier.

Numerics [n:#]
<<123.456, n:0>> "One Hundred and Twenty Three"
<<123.456, n:1>> "One Hundred and Twenty Three Point Five"
<<123.456, n:2>> "One Hundred and Twenty Three Point Four Six"
<<123.556, n:0>> "One Hundred and Twenty Four"
<<%%d:12345678:state%%, n:0>> "One Hundred and Twenty Four"
<<%%v:12345678%%, n:0>> "One Hundred and Twenty Four"

Note

The Numerics Modifier will round the value to the appropriate decimal places.


Indigo Substitutions [%%d:DEVICE ID:STATE NAME%%]
[%%v:VARIABLE ID%%]
%%d:12345678:temp%% Substitutes the state 'temp' for device 12345678.
%%v:12345678%% Substitutes the value for variable 12345678.

Note

You do not need to put Indigo substitutions within brackets unless you are also using a modifier; however, if brackets are used, they will not affect speech. For example, these two substitutions are identical when spoken:
%%d:12345678:intro%% or <<%%d:12345678:intro%%>> More information on Indigo substitutions.

If you see a need for a new kind of substitution, please post a Feature Request.