Getting voicerrs/text to speech to speak a string?

How do i make a rule with it saying a string, like temperature or date? Thanks

Say ("hello the temperature is " + temp + “degree”)
temp a number

1 Like

Do i need to define the number/text as
val String ? and what format @1technophile

In my case is defined either as an item, in this case use item.state either as a variable in this case use for example var int temp = 20. Text value could be declared as string

Cant quite get it to work. I have an item called Time. What would i need to declare in the rule?
String Time “Date [%1$tA, %1$td.%1$tm.%1$tY %1$tH:%1$tM]” { channel=“ntp:ntp:demo:dateTime” }

Id really appreciate some help here?

You need to use date formating like that in rules:
import java.util.Date
import java.text.SimpleDateFormat
var SimpleDateFormat df = new SimpleDateFormat( "YYYY-MM-dd HH:mm:ss" )
say("Domotique démarrée" + df.format( new Date() ))

That works @1technophile ! But do you know how to make it say month instead of 02 09 2017? Sounds a little rough and robotic.

Here is an idea:

Thanks for the help @1technophile but i am not very sharp in java, and when i try to enter anything i get errors in the eclipse smarthome designer. I dont know how to make it '“openhab compatible”

Try this:
var SimpleDateFormat df = new SimpleDateFormat( “dd-MMMM-YYYY HH:mm”)

Great! Now the date works, but the hours are still not. Also, i want it to say "and it is temperature outside from an item. Do you know how to add that too @1technophile
Really appreciate the help!