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

Inherits:
Object
  • Object
show all
Defined in:
lib/openhab/core/actions/voice.rb,
lib/openhab/rspec/openhab/core/actions.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



28
29
30
31
# File 'lib/openhab/core/actions/voice.rb', line 28

def say(text, voice: nil, sink: nil, volume: nil)
  volume = PercentType.new(volume) unless volume.is_a?(PercentType) || volume.nil?
  raw_say(text.to_s, voice&.to_s, sink&.to_s, volume)
end