Hello Ronald
I know that it is your code, and I have the deepest respect for this fine piece of work, that I have been using from the start. I just didnt want to reach out to you specifically, as I read further up the chain, that you stopped using (and updating this) a long time a go.
To be honest I have paused updating HA, and am still on 0.102.2 as its stable for me, and I dont miss any functionality. Not saying that I will never update, but for now this is good for me. I can read between the lines, that I might get into trouble with this UI, if updating to the newer versions however.
My question, should you have the time to answer was, In the alarm-controller.js you are calling the media player with the different actions:
this._mappingMediaPlayer = {‘turn_on’: ‘media_play’, ‘turn_off’: ‘media_pause’};
I know many programming languages, but unfortunately not .js and I cant figure out how to set the media.player.source before calling the action or simply define a default source.
You got me thinking though, maybe I should just call a script instead (I know how to write the particular script) from your code, instead of the media_player action… in this part of the same file in folowing sections:
_runAction(Action), and
_CallAlarmRingingService(Action)
_runAction(action) {
let tempAction = {
service: 'homeassistant.turn_on',
...action
}
let actualService = tempAction.service.split('.');
this._hass.callService(actualService[0], actualService[1], {"entity_id": tempAction.entity});
this._scripts[`${tempAction.entity}-${tempAction.when}`] = true;
}
_alarmRingingOn() {
this._isAlarmRinging = true;
this._callAlarmRingingService('turn_on');
}
_alarmRingingOff() {
this._isAlarmRinging = false;
this._callAlarmRingingService('turn_off');
}
_callAlarmRingingService(action) {
if(this.config.alarm_entities) {
for(let alarm_entity of this.config.alarm_entities) {
if(alarm_entity.entity_id.startsWith('media_player')) {
this._hass.callService('media_player', this._mappingMediaPlayer[action], {"entity_id": alarm_entity.entity_id});
} else {
this._hass.callService('homeassistant', action, {"entity_id": alarm_entity.entity_id});
}
}
}
}
/Michael