Class: OpenHAB::Core::Actions::Voice

Inherits:
Object
  • Object
show all
Defined in:
lib/openhab/core/actions/voice.rb

Overview

See Also:

Class Method Summary collapse

Class Method Details

.say(text, voice: nil, sink: nil, volume: nil) ⇒ void

This method returns an undefined value.

Say text via openHAB Text-To-Speech service, Voice.say()

Examples:

Run the TTS engine and output to the default audio sink.

rule 'Say the time every hour' do
  every :hour
  run { Voice.say "The time is #{TimeOfDay.now}" }
end

Parameters:

  • text (String)

    The text to say

  • voice (String) (defaults to: nil)

    Specify a particular voice to use

  • sink (String) (defaults to: nil)

    Specify a particular sink to output the speech

  • volume (PercentType) (defaults to: nil)

    Specify the volume for the speech



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/openhab/core/actions/voice.rb', line 25

def say(text, voice: nil, sink: nil, volume: nil)
  volume = PercentType.new(volume) unless volume.is_a?(PercentType) || volume.nil?
  java_send :say,
            [java.lang.Object,
             java.lang.String,
             java.lang.String,
             org.openhab.core.library.types.PercentType],
            text.to_s,
            voice&.to_s,
            sink&.to_s,
            volume
end