Tasker Integration (Android)

Agglo

New member
Joined
May 23, 2023
Messages
1
A plugin or other means to integrate Wiim Home with Tasker for Android (automation / remote control) would be fantastic.

Tasker has a large enthusiast user base and could be a good lever to further increase Wiim's popularity.

Think use cases such as "play music when I come home" or having player controls on your Android wallpaper or pull-down menu...

I used to do this with Sonos and it would be great to have this feature back.
 
You can do some of what the Sonos API provides, using the WiiM API (documentation here). Most of the basics (volume, play/pause, skip) are supported. A couple of differences to note:
  • Unlike with Sonos or Spotify, there's no need for OAUTH authentication or tokens. You just send HTTP commands to the desired player's IP address. You can do that with Tasker's "HTTP Request" action with parameters as follows:
    • Method = Get
    • Trust Any Certificate = checked on
    • URL = as described in the documentation above
    • (Similar for MacroDroid fans -- use its very similar "HTTP Request" action)
  • Thus, you'll want to set up your players to have static IP addresses. You can do that in the WiiM app, in each player's Setup / Network Status options, or if you prefer, in your router. Then, set up a Tasker macro that translates a player name to its static IP for use in HTTP requests.
  • Things you can't do yet with the WiiM API (at least that I've found):
    • Group and ungroup players
    • Get human-readable details on what's playing
    • Start playing a playlist/album/other in a service like Spotify, Tidal, etc. There are commands to start a media stream, and play a playlist file, but they seem oriented to your own local or cloud files vs. 3rd-party streaming services. But see next bullet...
  • Something you can do, even though it's not yet in the documentation (thanks to @onlyoneme for this information):
    • Start playing a player's preset # -- use https://<player-ip>/httpapi.asp?command=MCUKeyShortClick:x where x is the preset #
 
Things you can'tdo yet with the WiiM API (at least that I've found):
    • Group and ungroup players
    • Get human-readable details on what's playing
    • Start playing a playlist/album/other in a service like Spotify, Tidal, etc. There are commands to start a media stream, and play a playlist file, but they seem oriented to your own local or cloud files vs. 3rd-party streaming services.
All these and more can be done via the WiiM’s UPnP interface.
 
  • Like
Reactions: RSF
@cc_rider : Ah, yes; I should've mentioned that. I haven't tried that interface yet, but remember your mentioning this. I need to check it out...

@Agglo: If you plan to try the HTTP scheme in Tasker, at least for now, note that the HTTP API does support grouping and ungrouping, and (Pro only, not Mini) viewing currently-playing info, after all.
See this additional documentation site that provides more details than the WiiM documentation on the API (that other site appears to be from another company, but they share the same API scheme as WiiM).
Those commands are:
  • Group a player: https://<sub player IP>/httpapi.asp?command=ConnectMasterAp:JoinGroupMaster:eth<master player IP>
  • Ungroup a player: https://<master player IP>/httpapi.asp?command=multiroom:SlaveKickout:<sub player IP>
  • Viewing currently playing title/artist/album: The trick is to convert the title, artist, and album fields from the getPlayerStatus command from hex-strings to strings (e.g. "416c62756d204e616d65" to "Album Name"). Unfortunately, I'm not aware of any built-in scheme for that in Tasker, so you'd have to write a small Task for that -- loop through the input string to pick off two bytes at a time, use Tasker's Variable / Convert Variable / URL Decode action to convert \% plus that two-byte variable to a single readable character, and append that to the result string. You can test using a site like this one. Again, this only works on the Pro, not the Mini, which doesn't seem to return its currently-playing info in its getPlayerStatus result.
 
Back
Top