Example: LM visualization Voice status response

Task

Make dimmable light status response using LogicMachine via Google services.

Use resident script for creating sound files

Rus the following resident script once.

Source code    
  1. MP3_Data = {}
  2.  
  3. -- This % line has a different spoken text
  4. table.insert(MP3_Data, {filename = "0_PROCENT", text = "Turned off"})
  5. -- Create batch % files
  6. for i = 10, 100, 10 do --(Start , End, Stepsize)
  7. table.insert(MP3_Data, {filename = "" .. i .. "_PROCENT", text = "Turned on at " .. i .. " %"})
  8. end
  9. -- Create other spoken text files
  10. table.insert(MP3_Data, {filename = "PRESENCE_OFF", text = "Presence simulation turned off"})
  11. table.insert(MP3_Data, {filename = "PRESENCE_ON", text = "Presence simulation turned on"})
  12. table.insert(MP3_Data, {filename = "CENTRAL_OFF", text = "Everything is turned off you can leave the building"})
  13. table.insert(MP3_Data, {filename = "TIMER_OFF", text = "Timer turned off"})
  14. table.insert(MP3_Data, {filename = "TIMER_ON", text = "Timer turned on"})
  15. table.insert(MP3_Data, {filename = "SCENE_CALL", text = "Scene called"})
  16. table.insert(MP3_Data, {filename = "SCENE_SAVE", text = "Scene saved"})
  17. table.insert(MP3_Data, {filename = "SCENE_DELETE", text = "Scene deleted"})
  18. table.insert(MP3_Data, {filename = "SCENE_LOCKED", text = "Scene locked"})
  19. table.insert(MP3_Data, {filename = "SCENE_UNLOCKED", text = "Scene unlocked"})
  20. table.insert(MP3_Data, {filename = "ALARM_OFF", text = "There are no alarms anymore"})
  21. table.insert(MP3_Data, {filename = "ALARM_ON", text = "Alarm message from airconditioning please check the system"})
  22.  
  23. -- Loop through array to create the files with above filenames and text (change '&tl=en' inside URL to change your language, check translate.google API for more options)
  24. for index, MP3Data in pairs(MP3_Data) do
  25. -- Replace spaces with + sign.
  26. MP3Data.text = string.gsub(MP3Data.text, " ", "+")
  27. -- Create .MP3 from Google Translate (note: the DNS settings and default gateway needs to be correct in the system to access the internet)
  28. os.execute('wget -q -U Mozilla -O /www/scada/vis/' .. MP3Data.filename .. '.mp3 "http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q="' .. MP3Data.text)
  29. os.sleep(0.5)
  30. end
  31. --Remove all created mp3's
  32. --os.execute('rm /www/scada/vis/*.mp3')

Edit SVG file

Download this SVG file, open it in any redactor like Notaped and edit the *.mp3 file names so they are equal the ones in Resident script. Also define the grp address which by activation will call the mp3 sound files (in this file 0/0/1).

Add SVG to Image and drop in visualization

lm_voice_status_images

LM_voice_add_visu

Add corresponsing object into visualization

In the same floor where SVG file was added, add KNX object in a regular way

LM_voice_add_visu_object

Created by Erwin van der Zwart from Schneider Electric