The rough explanation on how I achieved this is:
- Create a new Virtual Device using my Generic Attribute Driver, adding this to a Maker API App install, copying / noting the Send Command URL and Device Id
- Install Tasker and AutoNotifications on the source devices such as mobile phones and tablets (pretty sure Tasker platform is Android only...)
- Create a new Profile, Event, Plugin, AutoNotification, Intercept
- Apply the following Configuration settings for the AutoNotifications Event
a. Action (Notification) Type = Only Created Notifications
b. Persistency Type = Persistent Only
c. Has Media Session = True (Ticked) - Add a Task to perform a HTTP Request, pasting in the Send Command URL, replacing the Device Id, setStringAttribute as the command and the parameter as %antitle (this %antitle variable, amongst others, is available automatically by having used the AutoNotification plugin for the Event trigger)
- If there is more than one cast device available in the home, include an IF condition in the Task, restricting on the %antext OR %ansubtext variable values, e.g. %antext Matches *Living Chromecast OR %ansubtext Matches *Living Chromecast
Test by casting a Youtube clip to the chromecast and reviewing the stringAttribute on the Virtual Device on the HE hub.
I then also setup an RM rule to reset the stringAttribute, triggered by a change in the custom attribute mediaSource on the Chromecast device in HE, running a conditional action IF the mediaSource custom attribute = "None", THEN run a custom action setStringAttribute on the Virtual Device, passing in a space (" ").
I would like to make this a much easier setup, but just happy to get something working for now. Developing an App for things like this and other Tasker setups, including importing profiles, etc, would be a nice little project one day.