Lovelace Alarm Clock

Hi rdehyss

Would you mind posting your sensor code for the holiday/workday sensor part ?

As a side note, I’l be looking into saving /reading the alarm entries to/from a MariaDB mysql server, so it doesnt loose the values if not “always on”. I have this running already for the History functionality. I’ll come back when solved.

/Michael

The readme.md has an example, at the bottom. I’m using a calendar.

Hi @rdehuyss,

This is exactly what I’m looking for.
I have issues with “variables” via HACS.

Can you confirm it still work for you?

Thank you.

I’ve since then moved and did not set this up in my new home. So, I can’t guarantee that it works for the moment…

I try to free up some time soon…

I have it working in 0.100 with variable from HACS but the toggle button are not showing anymore due to a change in Lovelace. I have open an issue in github.
HACS is creating a var folder instead of variable. It works for me after renaming the folder to variable

Oh ok,
Thank you for the reply (and sorry for not replying sooner, for some strange things, I didn’t get notified).
Can you input what you’re using now?

@MomoB good tip, thank you.

I’m now using my android phone… too lazy to set the tablet up again.

Hello @MomoB MomoB

I have the same issue with toggle buttons dissapeared. Are you updating this thread, if you get any responses on your GitHub post ?

/Michael

Hi,
I manually replaced paper-toggle-button by ha-switch in the source code and it did the trick.
I’m not a programmer and not familiar with GitHub but I will try to submit a pull request.

Hello @MomoB

And you’re absolutely right - that brings the buttons back again.Thanks a million :grinning:

Michael

Default media file / Sonos favorite as alarm ring tone

Hello I can’t program .js, so I’m not sure where to alter the code. Has anyone a solution to how to set a default either local sound file or Sonos favorite, that starts from the beginning every morning ?

Michael

I’m the original author of the card and am surprised it still works with the latest HA. Did you not need to do something special to get it working?

I’m currently not using it anymore so that’s why I wonder.

Regarding your question - you should be able to call any script. So, search here on the forum on how to start a Sonos song using a script and you should be fine.

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

Does this still work with latest HA version or is there any other alternative? This seems like the PERFECT alarm card with everything I was looking for

1 Like

Would indeed love to know aswell, Can’t find any other alternatives that have the same functionality