I can’t explain why the above-listed code isn’t working. But I can give you an example of code that works and which will play any Kodi playlist that you have (including smart playlists). I’m using HA 2021.3.2 and the following works for me. It uses the kodi.call_method service. You just need the specify three service calls:
The example above is a playlist that plays in random order. You can play in random order by using party mode, but I use smart playlists instead. To do it with a smart playlist, you just create the smart playlist, using whatever rules you want (e.g., Artist, Genre, Rating, etc) and then you just set “Order By” to “Random.” Now, every time Kodi opens that playlist the songs will be in random order.
If you want to do smart playlist where you pick each song individually, then you need to use a file tagger like Picard. Basically, you just pick a tag that isn’t typically used for music (I use “Comment”) and then pick any word you want to signify a particular playlist. The example above is a breakfast music playlist, so let’s just say I use the word “Breakfast” to identify this playlist. In Kodi, create a smart playlist with the rule “Comment equal Breakfast,” and set Order by to Random. Then, for every song you want to add to this playlist, load it in Picard and you will see the existing tags at the bottom of the screen. Right click any existing tag name, and then select “Add New Tag.” Then, in the pop-up that appears, start to type “comment” and you will see a dropdown list. Select “comment” from that list. Then click on Edit Value and type in “Breakfast.” Then you click Save in the pop-up, and Save again in Picard to write the new tag to the file. After you are done adding the tags to the songs that you want in your playlist, update your music library. And you now have a new playlist that will play the selected songs in random order.
There is a simpler method if you are not using the song ratings feature. All songs added have a default rating of zero stars, unless you assign a rating. If you don’t use this, you could create a smart playlist with the rule “Rating equals 1”, set Order by to Random, and then using the Kodi interface just select the songs you want and give then a rating of 1 start. You could create 10 smart playlists this way.
The issue here is that Smart playlists in Kodi are dependent on metadata. I’m not trying to play music but video that doesn’t have any real metadata, so I just can’t add it to a Smart playlist. My media live outside the Kodi library for specific reason, I only access it via the Kodi File browser. I cannot make Smart playlist with these files.