Skip to content

Developer Templates

Armilar edited this page Mar 1, 2024 · 52 revisions

Content

Screensaver

Entities

Screensaver

Screensaver - Changing Sunset/Sunrise in one Icon

// Bottom 7 - Sonnenaufgang - Sonnenuntergang im Wechsel
{
    template: 'text.accuweather.sunriseset',
    dpInit: '/^accuweather\.0.Daily.+/',
    modeScr: 'bottom',
},

Optional with other iconColor/text

        // Bottom 7 - Sonnenaufgang - Sonnenuntergang im Wechsel
        {
            template: 'text.accuweather.sunriseset',
            dpInit: '/^accuweather\.0.Daily.+/',
            modeScr: 'bottom',
            data: {
                icon: {
                    true: {
                        value: undefined,
                        color: {
                            type: 'const',
                            constVal: Color.MSYellow,
                        },
                    },
                    false: {
                        value: undefined,
                        color: {
                            type: 'const',
                            constVal: Color.MSYellow,
                        },
                    },
                },
                text: {
                    true: {
                        type: 'const',
                        constVal: 'Sonne',
                    },
                    false: undefined,
                },
            },
        },

Screensaver - accuweather.0. Forecast

        // Bottom 1 - accuWeather.0. Forecast Day 1
        {
            template: 'text.accuweather.bot2values',
            dpInit: '/^accuweather\\.0.+?d1$/',
            modeScr: 'bottom',
        },

        // Bottom 2 - accuWeather.0. Forecast Day 2
        {
            template: 'text.accuweather.bot2values',
            dpInit: '/^accuweather\\.0.+?d2$/',
            modeScr: 'bottom',
        },

        // Bottom 3 - accuWeather.0. Forecast Day 3
        {
            template: 'text.accuweather.bot2values',
            dpInit: '/^accuweather\\.0.+?d3$/',
            modeScr: 'bottom',
        },

        // Bottom 4 - accuWeather.0. Forecast Day 4
        {
            template: 'text.accuweather.bot2values',
            dpInit: '/^accuweather\\.0.+?d4$/',
            modeScr: 'bottom',
        },

        // Bottom 5 - accuWeather.0. Forecast Day 5
        {
            template: 'text.accuweather.bot2values',
            dpInit: '/^accuweather\\.0.+?d5$/',
            modeScr: 'bottom',
        },

Screensaver - daswetter.0. Forecast

Ersetzen, wenn Template steht

        // Bottom 6 - daswetter.0. Forecast Day 6
        {
            role: '2values',
            dpInit: '',
            type: 'text',
            modeScr: 'bottom',
            data: {
                entity1: {
                    value: { type: 'triggered', dp: 'daswetter.0.NextDays.Location_1.Day_6.Minimale_Temperatur_value' },
                    decimal: {
                        type: 'const',
                        constVal: 0,
                    },
                    factor: undefined,
                    unit: {
                        type: 'const',
                        constVal: '° ',
                    },
                },
                entity2: {
                    value: { type: 'triggered', dp: 'daswetter.0.NextDays.Location_1.Day_6.Maximale_Temperatur_value' },
                    decimal: {
                        type: 'const',
                        constVal: 0,
                    },
                    factor: undefined,
                    unit: {
                        type: 'const',
                        constVal: '°',
                    },
                },
                icon: {
                    true: {
                        value: {
                            type: 'triggered',
                            dp: 'daswetter.0.NextDays.Location_1.Day_6.Wetter_Symbol_id',
                            read: `{
                                        switch (val) {
		                                    case 1:         // Sonnig
                                                return 'weather-sunny';  // sunny
 
			                                case 2:         // Teils bewölkt
                                            case 3:         // Bewölkt
                                                return 'weather-partly-cloudy';  // partlycloudy
				
                                            case 4:         // Bedeckt
                                                return 'weather-cloudy';  // cloudy
				
                                            case 5:        // Teils bewölkt mit leichtem Regen
                                            case 6:        // Bewölkt mit leichtem Regen
                                            case 8:        // Teils bewölkt mit mäßigem Regen
                                            case 9:        // Bewölkt mit mäßigem Regen
                                                return 'weather-partly-rainy';  // partly-rainy
				
                                            case 7:        // Bedeckt mit leichtem Regen
                                                return 'weather-rainy';  // rainy
				
		                                    case 10:        // Bedeckt mit mäßigem Regen
                                                return 'weather-pouring';  // pouring
				
                                            case 11:        // Teils bewölkt mit starken Regenschauern
                                            case 12:        // Bewölkt mit stürmischen Regenschauern
                                                return 'weather-partly-lightning';  // partlylightning
				
                                            case 13:        // Bedeckt mit stürmischen Regenschauern
                                                return 'weather-lightning';  // lightning
				
                                            case 14:        // Teils bewölkt mit stürmischen Regenschauern und Hagel
			                                case 15:        // Bewölkt mit stürmischen Regenschauern und Hagel
			                                case 16:        // Bedeckt mit stürmischen Regenschauern und Hagel
                                                return 'weather-hail';  // Hail
 
                                            case 17:        // Teils bewölkt mit Schnee
                                            case 18:        // Bewölkt mit Schnee
                                                return 'weather-partly-snowy';  // partlysnowy

                                            case 19:        // Bedeckt mit Schneeschauern
                                                return 'weather-snowy';  // snowy
 
                                            case 20:        // Teils bewölkt mit Schneeregen
                                            case 21:        // Bewölkt mit Schneeregen
                                                return 'weather-partly-snowy-rainy';
 
                                            case 22:        // Bedeckt mit Schneeregen
                                                return 'weather-snowy-rainy';  // snowy-rainy
 
                                            default:
                                                return 'alert-circle-outline';
                                        }
                                    }`,
                        },
                        color: {
                            type: 'triggered',
                            dp: 'daswetter.0.NextDays.Location_1.Day_6.Wetter_Symbol_id',
                            read: `{
                                        switch (val) {
                                            case 1:         // Sonnig
                                                return Color.swSunny;
 
                                            case 2:         // Teils bewölkt
                                            case 3:         // Bewölkt
                                                return Color.swPartlycloudy;
 
                                            case 4:         // Bedeckt
                                                return Color.swCloudy;
 
                                            case 5:        // Teils bewölkt mit leichtem Regen
                                            case 6:        // Bewölkt mit leichtem Regen
                                            case 8:        // Teils bewölkt mit mäßigem Regen
                                            case 9:        // Bewölkt mit mäßigem Regen
                                                return Color.swRainy;
 
                                            case 7:        // Bedeckt mit leichtem Regen
                                                return Color.swRainy;

                                            case 10:        // Bedeckt mit mäßigem Regen
                                                return Color.swPouring;
 
                                            case 11:        // Teils bewölkt mit starken Regenschauern
                                            case 12:        // Bewölkt mit stürmischen Regenschauern
                                                return Color.swLightningRainy;
 
                                            case 13:        // Bedeckt mit stürmischen Regenschauern
                                                return Color.swLightning;
 
                                            case 14:        // Teils bewölkt mit stürmischen Regenschauern und Hagel
			                                case 15:        // Bewölkt mit stürmischen Regenschauern und Hagel
			                                case 16:        // Bedeckt mit stürmischen Regenschauern und Hagel
                                                return Color.swHail;
 
                                            case 17:        // Teils bewölkt mit Schnee
                                            case 18:        // Bewölkt mit Schnee
                                                return Color.swSnowy;
 
                                            case 19:        // Bedeckt mit Schneeschauern
                                                return Color.swSnowy;
 
                                            case 20:        // Teils bewölkt mit Schneeregen
                                            case 21:        // Bewölkt mit Schneeregen
                                                return Color.swSnowyRainy;  // snowy-rainy
 
                                            case 22:        // Bedeckt mit Schneeregen
                                                return Color.swSnowyRainy;
 
                                            default:
                                                return Color.White;
                                        }
                                    }`,
                        },
                    },
                    false: {
                        value: undefined,
                        color: undefined
                    },
                    scale: undefined,
                    maxBri: undefined,
                    minBri: undefined,
                },
                text: {
                    true: {
                        type: 'triggered',
                        dp: 'daswetter.0.NextDays.Location_1.Day_6.Tag_value',                        
                        read:  `{
                                    return (val).substring(0,2);
                                }`,
                    },
                    false: undefined,
                },
            },
        },

Entities

IKEA Fyrtur

        // Ikea Fyrtur Rollo - Template
        {
            role: '',
            type: 'shutter',
            dpInit: 'deconz.0.Lights.37',
            data: {
                icon: {
                    true: {
                        value: { 
                            type: 'const', 
                            constVal: 'window-shutter-open' 
                        },
                        color: { 
                            type: 'const', 
                            constVal: Color.Green 
                        },
                    },
                    false: {
                        value: { 
                            type: 'const', 
                            constVal: 'window-shutter' 
                        },
                        color: { 
                            type: 'const', 
                            constVal: Color.HMIOff 
                        },
                    },
                    scale: undefined,
                    maxBri: undefined,
                    minBri: undefined,
                },
                // 1. slider
                entity1: {
                    // button
                    value: { 
                        mode: 'auto', 
                        role: 'level.value', 
                        type: 'triggered', 
                        dp: '.lift' 
                    },
                    decimal: undefined,
                    factor: undefined,
                    unit: undefined,
                    minScale: { 
                        type: 'const', 
                        constVal: 1 
                    },
                    maxScale: { 
                        type: 'const', 
                        constVal: 78 
                    },
                },
                // 2. slider
                entity2: undefined,
                text: {
                    true: {
                        type: 'const',
                        constVal: 'Büro',
                    },
                    false: undefined,
                },
                headline: {
                    type: 'const',
                    constVal: 'IKEA Fyrtur',
                },
                text1: {
                    true: {
                        type: 'const',
                        constVal: 'Rollo Position',
                    },
                    false: undefined,
                },
                text2: undefined,
                up: { 
                    mode: 'auto', 
                    role: 'level.value', 
                    type: 'triggered', 
                    dp: '.lift' , 
                    write: 'return 1'
                },
                down: { 
                    mode: 'auto', 
                    role: 'level.value', 
                    type: 'triggered', 
                    dp: '.lift' , 
                    write: 'return 78'
                },
                stop: {
                    type: 'state',
                    dp: '.stop',
                    mode: 'auto',
                    role: ['button'],
                },
            },
        },

Clone this wiki locally