I am mostly for the voice commands where you can turn the tabled display on and off by voice. That is enough for me
This is an example routine to turn on the tablet screen with Google Assistant voice control and play preset 1 of WiiM device.
If you only want to turn the screen on/off with voice, it will work with Google Assistant only. (For music playback, use the remote or another phone.)
[01] Google Assistant Routine (Turn on tablet screen)
[02] Google Assistant Routine (Turn off tablet screen)
Next, this is a routine for the Macrodroid app.
[01] Macrodroid Routine (Turn on tablet screen)
When Google Assistant activates WHA,
1) Macrodroid taps the specified position on the screen by "UI screen operation",
1) Macrodroid taps the specified position on the screen with "UI screen operation" to display the Now playing screen.
2) Macrodroid will send the URL of WiiM api by HTTP request and play the preset 1.
#Note that need to sensitive permissions if you want Macrodroid to do this.
(Also, the position of the screen click needs to be modified.)
If only the yellow frame is set, only the playback of Preset 1 is executed.
#Turn off until all testing is complete.
This is actual normal operation.
View attachment 634283ab-6257-499f-96a1-8c25355657f4-1_all_8182.mp4
This is a routine to stop music and turn off the screen in Macrodroid.
[02] Macrodroid Routine (Turn off tablet screen)
#Turn off until all testing is complete. If left on, the screen will turn off every time you close WHA.
This is actual normal operation.
View attachment 634283ab-6257-499f-96a1-8c25355657f4-1_all_8184.mp4
This is how HTTP Requests are configured.
Preset 1 Playback
(Change the last number to select Preset 1-12)
https://XXX.XXX.XX.XX/httpapi.asp?command=MCUKeyShortClick:1
Music stop
https://XXX.XXX.XX.XX/httpapi.asp?command=setPlayerCmd
ause
Replace "
XXX.XXX.XX.XX" with the IP address of your WiiM device.
[Settings required for tablet]
- Disable sleep.
- Turn off battery optimization for all apps used here and lock apps.
- Turn on "Activate assistant while screen is locked" in your tablet's Google account, and do a voice match.
Also, if you want to perform sensitive actions on your Macrodroid, I recommend that you uninstall all unnecessary apps and use it completely exclusively for WiiM. If your tablet has a macro function, you can use it.
e.g., Galaxy routines or iOS shortcuts.
Note that Android devices enter Doze mode (deep sleep) after a certain period of time after sleep. If Google Assistant does not start the next day, try this routine.
This is a routine to turn on the screen every 20 minutes when the screen is off. 1-5 is all that is needed to make it work.
Please let me know if it does not work

.