UPDATE: HA-meural is now available through HACS. It’s no longer necessary to manually copy the code or add it as a custom repository first. You can find it listed under integrations in HACS as: HA-meural.
Original post:
I’ve recently purchased a Netgear Meural Canvas II, a digital art frame that can display both your own images and a collection of classic and modern art via Meural’s subscription system. After finding the following topic here I was inspired to work on an integration to control the Canvas from Home Assistant:
The integration is available here:
The Canvas offers both a local interface and a cloud API. This integration leverages both to control the Canvas as a media player in Home Assistant. This way all regular media player services work as you’d expect - you can turn the Canvas on or off, pause and play, go to previous/next image, change playlists and set shuffle. It will retrieve artwork thumbnail, artwork title and artist name to display in the Media Control card. Looks like this in Lovelace:
There are also some service calls registered under the meural.xxx domain that will let you set brightness, reset the brightness based on current ambient light, set device options on the Meural server, or toggle display of the information card on your device.
Additionally, because it’s set up as a media player, it can be exposed to Google Assistant (as opposed to the Alexa-only support that Meural offers) via Nabu Casa or your manually configured setup. As a proof of concept I posted this video to Twitter:
I’m not a dev and the last time I coded in Python was when I was at university, over a decade ago, so this is very much a learning-by-doing experiment. Feel free to give me feedback on what can be improved!
Bringing in a reply from another topic to centralize here.
Can you check if any media_player is being created? It’s created using the canvas name of the device you have set up on Meural’s servers. E.g. this is what it looks like on Meural’s website for me:
I’ve renamed mine to be named ‘Mural’ (because of testing with Google Home, so it knows what I’m talking about when I say ‘Meural’). My entity is called: media_player.mural
If you haven’t renamed it, the default Meural names are a painter’s name with a dash and 3 numbers, like picasso-491. Then your entity would be called: media_player.picasso-491
Great news! And if you rename the Canvas, just restart Home Assistant and it will create a new entity with the new corresponding name instead!
I just updated the master branch on github again, worth updating to that while you’re at it. It speeds up switching playlists a LOT (like, in the order of 10x) by moving to local calls instead of always going through an upload via the Meural API.
And I’ll look into better logging messages, I haven’t looked into that part at all to be honest. It’s basically doing whatever the default scaffolding @balloob built me says.
So far I’ve only worked on the passive side of playing art/playlists already in the system, so I haven’t really looked into it, but according to the REST API docs we could definitely upload new images. The current play_media code will only accept an item ID for images uploaded to Meural’s servers, not file paths, so I suppose you could upload the image from the doorbell to Meural and display the new item immediately afterwards.
Turns out there IS a local option, there’s a /remote/postcard/ call that the web remote uses to temporarily override the currently displayed item (it won’t show in your media control card). If you to go to the remote it’s the camera icon in the top-right:
Works fine on my frame from the web remote, I just don’t know how to send the data to upload an image for a call like this. Never did something like that before.
Gave it a shot tonight but I’m afraid dealing with retrieving the image from a given URL, then POSTing that image to the remote/postcard call is a few bridges too far for me right now. No experience at all with doing that in python.
I spent way too long diving into the depths of aiohttp chasing down a bug, when in the end it looks like there may just be a bug in the Meural web server. Both through this and with the remote web control, uploading an image sometimes makes the meural display a previously uploaded image. When it hits that state, I can’t recover. A reboot helps.
Thanks, that’s awesome! I’m running your code now, this seems to work perfectly. Haven’t managed to crash it out to a previously uploaded image yet, either. I’m just torn if this should be a part of play_media because it’s not actually playing (changing the current item being displayed) but previewing.
I’ve got the v2. Don’t really know if there are really any differences between the two, aside from the frame and the smaller 21" size they added to the v2 line-up.
Previewing is a term Meural uses for sending an image to the Canvas to be displayed that is not officially on that device yet; it’s normally used to preview art you might want to buy from their art collection on the large screen.
Ah, this seems to be different for us. It is not permanent for me - it displays exactly as long as the preview duration you can set through the Meural web interface - that’s why I’m pretty sure postcard is the same as Meural’s preview system. I had that set to 60 seconds so after a minute it went back to my original playlist.
BTW, notice the inspect console on the right. This is right after uploading an image.
Can you do the same thing? Ctrl-Shift-I for inspect, open the Network tab, upload the image, then click on the postcard/ URL on the left, and click on “Source” bottom right for the form data.
There appears to be no setting here for any of the durations, nor of several other settings (eg Shuffle) that can only be set via the Meural app or Meural website. It’s one of the things that I don’t know how to deal with yet - if I could get and set these locally, we wouldn’t have to deal with the Meural servers at all.
The image I posted was from the interface on Meural’s website, but the same settings can be set through the Meural app.
The Preview duration is the one that I was referring to. I can’t set it locally from the web remote, but that settings does influence how long the postcard image remains visible on my device.