ticaki / ioBroker.nspanel-lovelace-ui

MIT License
5 stars 1 forks source link

cardMedia - Spotify Seek Funktion #24

Open Armilar opened 8 months ago

Armilar commented 8 months ago

image

image

verwendetes Icon: 'play-speed'

InSel befüllen valueList: {type: 'const', constVal: '0%?10%?20%?30%?40%?50%?60%?70%?80%?90%?100%'},

InSel Rückgabe mit 10 multiplizieren setState('soptify-premium.0.player.progressPercentage', parseInt(words[4]) * 10);

Armilar commented 8 months ago

Aktuell so gelöst:

        // Item 6 - Seek
        {
            role: 'text.list',
            type: 'input_sel',
            dpInit: '',
            data: {
                icon: {
                    true: {
                        value: {type: 'const', constVal: 'play-speed'},
                        color: {type: 'const', constVal: Color.HMIOn},
                    },
                },
                entityInSel: {
                    value: {
                        type: 'const',
                        constVal: true,
                    },
                },
                valueList: {type: 'const', constVal: '0%?10%?20%?30%?40%?50%?60%?70%?80%?90%?100%'},
                setList: {
                    type: 'const',
                    constVal: 'spotify-premium.0.player.progressPercentage?0|'  +
                              'spotify-premium.0.player.progressPercentage?10|' +
                              'spotify-premium.0.player.progressPercentage?20|' +
                              'spotify-premium.0.player.progressPercentage?30|' +
                              'spotify-premium.0.player.progressPercentage?40|' +
                              'spotify-premium.0.player.progressPercentage?50|' +
                              'spotify-premium.0.player.progressPercentage?60|' +
                              'spotify-premium.0.player.progressPercentage?70|' +
                              'spotify-premium.0.player.progressPercentage?80|' +
                              'spotify-premium.0.player.progressPercentage?90|' +
                              'spotify-premium.0.player.progressPercentage?100|'
                },
                headline: {type: 'const', constVal: 'Seek'},
            },
        },

Es wird allerdings auf diese Art keine aktuelle Position markiert und auch nicht selektiert.

Es müsste also analog NSPanelTs.ts die aktuelle Position ermittelt werden und auch aktualisiert werden können.

LESEN:

const actualStateTemp: number = getState(spotify-premium.0.player.progressPercentage').val;
actualState = Math.round(actualStateTemp / 10) * 10 + '%';
optionalString = '0%?10%?20%?30%?40%?50%?60%?70%?80%?90%?100%';

SCHREIBEN:

setState(spotify-premium.0.player.progressPercentage', <<Wert aus InSel>>) * 10);
ticaki commented 8 months ago

Müsste ich nochmal testen aber eigentlich sollte das aus setList in die entsprechenden States geschrieben werden