Gábor Tályai Posted July 28 Share Posted July 28 The new firmware (2.10 Beta) of the Wall Display allows us to attach an MP3 playback to any event! LOCAL ACTIONS This can be most easily implemented as a local action: for example, when a device is turned on, add to the device's actions that if it is on, it should execute this URL: http://10.10.40.10/rpc/Media.MediaPlayer.PlayAudioClip?id=1&volume=10 Where: 10.10.40.10 is the IP address of the Wall Display id=1 is the identifier of the uploaded MP3 file volume=10 is the volume level  UPLOAD MP3 Of course, we will need to upload the appropriate MP3 file to the Wall Display. This can be done through the WD local interface. After uploading, the MP3, the ID will appear, allowing us to reference it - it is id 17 in the upper example.  Use TEXT-TO-SPEECH to make the voice I use https://app.fliki.ai to create text-to-speech messages because it supports Hungarian, but any text-to-speech program can be used to generate the appropriate message, or we can play music. However, I believe clear human voice messages are more useful.  USE SCRIPT TO CONTROL VOICE Of course, there are some things we can't solve with local actions, but for those, we can write a script. The following script does the following: Monitors the state of a reed relay connected to a Shelly Add-on (whether the door is open or not) Checks every 5 seconds if the door is open If the door is open for 30 seconds, it plays a message that the door is open, then repeats this message every 30 seconds until the door is closed We need this at the company (http://www.anrodiszlec.hu) to avoid energy loss if we are heating or cooling and doors are left open. This way, we notify colleagues to close the damn door because we can't heat the whole yard 🙂 Here is the script, don't forget to change the ip address of the Wall Display, and input ID, and anything you want on the volume and timer section. let off_counter = 0; const check_interval = 5000; // 5 seconds const off_duration = 30000; // 30 seconds let input_id = 100; // ID for the input let audio_id = 16; // ID for the audio clip let audio_volume = 8; // Volume for the audio clip // Monitor the state of the door Input(100) every 5 seconds Timer.set(check_interval, true, function () {    Shelly.call("input.getstatus", { id: input_id }, function (result, error_code, error_message) {        if (error_code !== 0) {            print("Error occurred during input.getstatus call: " + error_message);        } else {            if (result && typeof result.state !== 'undefined') {                if (result.state === true) {                    off_counter += check_interval;                    print("Input(" + input_id + ") is OFF. Incrementing counter: " + off_counter + " ms");                    if (off_counter >= off_duration) { // OFF for 30 seconds                        // Execute the URL                        let url = "http://10.10.40.10/rpc/Media.MediaPlayer.PlayAudioClip?id=" + audio_id + "&volume=" + audio_volume;                        Shelly.call("HTTP.GET", { url: url }, function (http_result, http_error_code, http_error_message) {                            if (http_error_code !== 0) {                                print("Error occurred during the URL call: " + http_error_message);                            } else {                                print("URL executed successfully.");                                off_counter = 0; // Reset counter after notification                            }                        });                    }                } else {                    print("Input(" + input_id + ") is ON.");                    off_counter = 0; // Reset counter if state is ON                }            } else {                print("The result object is undefined or missing the state property.");            }        }    }); }); 2 Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish Link to comment Share on other sites More sharing options...
Martin_ Posted July 28 Share Posted July 28 (edited) @Gábor Tályai Hi. Fun thing to get audio to the display, great idea! I would like to incorporate a sound to a button press in a virtual device (on the display), but i get an error. I have changed the id to 1 (as it is my clip ID) but i get this error: [21:25:47] [Webhooks]: Error executing webhook: com.android.volley.NoConnectionError: java.net.ConnectException: Connection refused   I could not find the API / manual for the Display to get further. Edited July 28 by Martin_ Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish Link to comment Share on other sites More sharing options...
Shelly Olsche Posted July 28 Shelly Share Posted July 28 for local playing use 127.0.0.1 instead WD_IP: http://127.0.0.1/rpc/Media.MediaPlayer.PlayAudioClip?id=1&volume=10 see also here: Â 1 Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish Link to comment Share on other sites More sharing options...
Martin_ Posted July 29 Share Posted July 29 @Olsche Fantastic, works great! Thanks for the api post information also Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.