Hi all,
I have a simple rule that is dependant on a item state as per follows:
// Chromecast (http://www.radiofeeds.co.uk/)
rules.JSRule({
id: "ChromecastGroupPlaylist",
name: "Chromecast Group Playlist",
description: "Play radio on Chromecast Group Devices",
triggers: [triggers.ItemCommandTrigger("chromecast_Group_PlayListURL")],
execute: event => {
// Declare all variables
const logger = log("Chromecast.Group");
const castAction = actions.get("chromecast","chromecast:audiogroup:home_group");
const castTitle = items.getItem("chromecast_Group_PlaylistTitle");
logger.debug("Chromecast Group Script - Start");
console.info("Received Command:", event.receivedCommand);
switch (event.receivedCommand) {
case "bbcAsianNetwork":
castAction.playURL("http://lstn.lv/bbc.m3u8?station=bbc_asian_network&bitrate=320000");
castTitle.postUpdate("BBC Asian Network");
break;
case "desiRadio":
castAction.playURL("http://radio.canstream.co.uk:8001/live.mp3");
castTitle.postUpdate("Desi Radio");
break;
case "gulshanRadio":
castAction.playURL("http://s3.voscast.com:11510/;.mp3");
castTitle.postUpdate("Gulshan Radio");
break;
case "panjabRadio":
castAction.playURL("http://91.121.134.23:8584/stream");
castTitle.postUpdate("Panjab Radio");
break;
}
logger.debug("Chromecast Group Script - End");
}
});
Now, it triggers and casts the radio no issues. However, the playlist title will automatically go to ‘UNDEF’ after setting it. Please see logs below:
2024-11-25 17:48:37.521 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'chromecast_Group_PlayListURL' changed from NULL to bbcAsianNetwork
2024-11-25 17:48:38.945 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'chromecast_Group_PlaylistTitle' changed from UNDEF to BBC Asian Network
2024-11-25 17:48:41.016 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'chromecast_Group_Switch' changed from ON to OFF
2024-11-25 17:48:41.901 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'chromecast_Group_PlaylistTitle' changed from BBC Asian Network to UNDEF
This is true for all variations.
Any assistance will be greatly appreciated.
Many thanks in advanced!
Jeevs