Tips: Omstart av Service när Duo slutar ta emot signaler

Moderators: hekj, Telldus

Post Reply
hekj
Posts: 992
Joined: Fri Mar 17, 2023 9:45 am
Location: Stockholm
Contact:

Tips: Omstart av Service när Duo slutar ta emot signaler

Post by hekj »

Den som kör testversionen av NexaHome i windows xp kan automaticera omstart av Telldus Service vid felindikation.

1) skapa filen check_temp.bsh med följande innehåll (skriv in dina egna sensorers device id på första raden)

Code: Select all

String[] sensors = { "101", "102" };  // device id    
String[] timestamps = new String[sensors.length];  // sensor timestamps
changed = false;
for (int ndx = 0; ndx < sensors.length; ndx++) {
    sensor = sensors[ndx];
    timestamps[ndx] = getSensorTimestamp(sensor);
    if (timestamps[ndx] != null) {
        previous_timestamp = getData("previous_timestamp" + sensor);
        if (!timestamps[ndx].equals(previous_timestamp)) {
            changed = true;
            setData("previous_timestamp" + sensor, timestamps[ndx]);
        }
    }
}
if (changed) {
    hideOutput();
} else {
    echo("No sensor data received...");

    // Save Telldus debug files
    import java.text.SimpleDateFormat;
    import java.io.File;
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmm");
    timestamp = sdf.format(Calendar.getInstance().getTime());
    f1 = new File("C:/telldus_service_debug.txt");
    if (f1.exists()) {
       f2 = new File("C:/telldus_service_debug." + timestamp + ".txt");
       f1.renameTo(f2);
    }
    f1 = new File("C:/telldus_client_debug.txt");
    if (f1.exists()) {
       f2 = new File("C:/telldus_client_debug." + timestamp + ".txt");
       f1.renameTo(f2);
    }

    execFile("C:/apps/nexahome/restart_telldus_service.bat");
}
startTimer("check_temp", 5 * 60);
2) skapa filen restart_telldus_service.bat

Code: Select all

net stop "Telldus Service"
net start "Telldus Service"
För att få övervakningen att starta måste man utföra följande.

3) avsluta NexaHome
4) skapa filen start.bsh om du inte redan har en fil med detta namn
5) lägg till följande rad i filen start.bsh

Code: Select all

startTimer("check_temp", 5 * 60);
6) starta NexaHome

Eventuellt så måste man även använda de nya versionerna av Telldus Core och Telldus Service (dessa loggar info till två filer på C:\) för att få igång mottagning av signaler efter återstart av service.
http://telld.us/ellduservice3

Edit: 2012-10-02 Bsh script uppdaterat, sparar Telldus loggar.
Post Reply