HomeyScript problem

Hello. My flows don’t works. I have some pause icon here. What’s going on? Thanks.

That could mean the app is disabled, or didn’t start properly. Have you tried restarting the Homeyscript app?

Thanks! It’s working now. I really need to save all my scripts. :smiley:

When this happens again check the memory usage of homeyscript app. In my situation some scripts were using statements with memory leak, so memory usage of homey script app goes up. When it hits around 80 mb the homeyscript app is paused by homey.

1 Like

@Thomas_Buran, Just a tip: if you need a script to backup your scripts, here is a script i use to send all scripts to a backup server. You can use this script with HomeyScript. Schedule it to run every night and you have always a recent backup

'use strict';
function execute() {
Homey.apps.getApp({id:'com.athom.homeyscript/'}).then(homeyScript => {
    homeyScript.apiGet('script').then(async scripts => {
        var len = scripts.length
        for (var x = 0; x < len;++x) {
            const scriptName = scripts[x]    

            await homeyScript.apiGet('script/'+scriptName).then(data => {
                fetch('http://192.168.1.222:3002/backupscripts',{
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json'
                    },
                    body: JSON.stringify({
                        scriptName: scriptName,
                        scriptData: data.code
                    })
                }).then(async (response) => await response.text()).catch(e => {
                    Homey.apps.getApp({id:'nl.nielsdeklerk.log'}).then(simpleLog => {
                        simpleLog.apiPut('addlog',{log: `Unable to send script ${scriptName} to backup server`,group:'SCRIPT BACKUP'});
                    })
                });
            })
        }
    })
});
}
execute();
2 Likes

Your scripts are also backupped as part of a Homey backup. However, you cannot restore them individually. that would require you to backup, restore another backup with the scrips, download the scripts you need, restore the last backup and upload your scripts again. Bothersome, but feasible. I have but a few, so I cut and paste to file when I change them.

1 Like