Help with driver - Wiim Music Player

You could - it will be in resp.data, but I think it's overkill because :

AFAIK httpGet throws an exception on anything that's not a 2xx, so doing the sendEvent() from the try{} block is good enough.

@johnwill1 if I can offer a candid opinion : I fear you're going down a pretty deep rabbit hole here. Your driver is not currently built to receive state updates from the Wiim player so any operations on the player itself (or done through a different means, like a phone app) will not be reflected and your current states will get out of sync with reality. Unless the Wiim API offers some sort of web hook / callback capability to inform your driver of state changes, you'd have to poll the device state somehow and reconcile it with whatever the driver thinks the state is. Not a super easy task.

Honestly aside from the learning experience (bravo for your progress so far ! ) I don't really see much point in trying to update attributes (current states) or even honoring the Music Player capability if all you need is a stateless driver to wrap HTTP calls to an https endpoint running with a self-signed cert.

1 Like

Yeah I think I agree. I can't see from the documentation any means for the player to report back changes made elsewhere. The device could be polled with

/httpapi.asp?command=getPlayerStatus

that returns json with a number of items - the source, playback status, volume and mute status. I guess that could be used but it would need to be done on a schedule and following each command from the driver.

I suppose the only benefit for me of the Music Player capability might have been that I could easier add it to a dashboard (which I use throughout the house) for very basic control. For the few commands I need on the dashboards (call a preset, mute, pause, stop) I can just do it with button controller.

From what I've read on the Wiim forum, far more commands are available using UPnP and others have implemented that in Home Assistant (ugh, there's always more available in Home Assistant it seems but that too is a rabbit hole I'd rather not go down - K.I.S.S)

I'll probably just put it back how it was without Music Player capability so I've nothing visible that doesn't work.