Play song when smart plug turns on


I was wondering if anyone would know how to do this. I would like i specific song to play when one of my tp-link smart plugs turns on through a chromecast audio. Does anyone have any idea how to make this happen or if it is even possible through a rule or a script? Thanks.

This may depend on how you have your tp-link plug configured to work with OH, if OH is the main control point add a rule for when the plug turns on stream song to chromecast.
I don’t have chrome cast so I’m not familiar with how you cast to it from OH, and this also assumes you have the song located in a location that OH can access.

Sure that is possible. You need to have an item linked to your plug, and write a rule that triggers to the event (changed to on or changed to off, changes in power consumption, etc) you want. As already stated above, you need a sound file and then you can use the play command as stated in the docs:

Also search the forum, there are a lot of examples for playing a sound triggered by an event in OH2.

Thank you for your response. I’m waiting on my new smart plug (should get it today) and then ill be able to try this. Thank you for the help.