Cool stuff for Raspberry Pi, Arduino and all electronics hobby projects
Notifications
Clear all

[Solved / Archived] Witty pi 4 auto restart problem

6 Posts
4 Users
0 Likes
721 Views
(@jonathan-carpentier)
Posts: 1
New Member Customer
Topic starter
 

Bonjour, j’ai un problème avec le redémarrage automatique de mon raspi connecté à un witty pi 4, le script s’exécute correctement pendant une série de 6 à 8 fois puis l’auto-start ne redémarre pas, en réactivant le witty pi 4 manuellement, je redémarre sur un cycle aléatoire de 6 à 10 redémarrage automatique puis le redémarrage automatique ne s’exécute plus, Avez-vous une idée de mon problème ?


(Translated by Google)

Hello, I have a problem with the auto-start of my raspi connected to a witty pi 4, the script runs correctly for a series of 6 to 8 times then the auto-start does not restart, reactivating the witty pi 4 manually, I restart on a random cycle of 6 to 10 automatic restart then the automatic restart no longer runs, Do you have any idea what my problem is?

 
Posted : 05/11/2023 12:44 pm
(@admin)
Posts: 479
Member Admin
 

It is impossible to guess what actually happened without having more information. If the schedule stop working, usually you can figure out the reason by checking the wittyPi.log file. Please attach the wittyPi.log file if you want us to check it.

 
Posted : 06/11/2023 1:56 pm
(@anetmo)
Posts: 7
Active Member
 

Hello,

I'm the person in charge of developing the project.

I'm following up on my client's message.
The system works autonomously without any problem for a random period of time, and all of a sudden the Witty stops starting the device.

For example, it's been working since 16 November, switching on every 30 minutes from 8am to 6pm.
And this morning, it started up correctly at 8.30am, the Python script correctly told the Witty when it should start up next (9am), but it didn't start up automatically at 9am.

We have security for our scripts, which is :
- First script, whose sole purpose is to give the Witty a start-up time (in case the second script crashes).
- Second script, which is the entire logic of the device (retrieving data from the API, setting the next start time based on information from the API, taking photos, sending photos to the API).

The 2nd script produces logs, which tell me that the time has been set on the Witty:

2023-11-29 08:30:21 - INFO - Internet not up, retry in 5 seconds
2023-11-29 08:30:42 - INFO - Device have internet
2023-11-29 08:30:50 - INFO - New date set into system & RTC : 23/11/29 3 08:30:50
2023-11-29 08:30:56 - INFO - Next startup scheduled at 2023-11-29 09:00:00
2023-11-29 08:31:11 - INFO - handleUploadRotate - Upload success
2023-11-29 08:31:11 - INFO - handleUploadRotate - Files removed

Here are the logs from the wittyPi.log file:

[xxxx-xx-xx xx:xx:xx] Witty Pi daemon (v4.13) is started.
[xxxx-xx-xx xx:xx:xx] Running on Raspberry Pi 3 Model A Plus Rev 1.0
[xxxx-xx-xx xx:xx:xx] Seems RTC has good time, write RTC time into system
[xxxx-xx-xx xx:xx:xx] Writing RTC time to system...
[2023-11-28 18:00:20] Done :-)
[2023-11-28 18:00:20] Firmware ID: 0x00
[2023-11-28 18:00:20] Firmware Revison: 0x05
[2023-11-28 18:00:20] Current Vout=5.04V, Iout=0A
[2023-11-28 18:00:20] System starts up because scheduled startup is due.
[2023-11-28 18:00:25] Send out the SYS_UP signal via GPIO-17 pin.
[2023-11-28 18:00:25] File "schedule.wpi" not found, skip running schedule script.
[2023-11-28 18:00:25] Pending for incoming shutdown command...
[xxxx-xx-xx xx:xx:xx] Witty Pi daemon (v4.13) is started.
[xxxx-xx-xx xx:xx:xx] Running on Raspberry Pi 3 Model A Plus Rev 1.0
[xxxx-xx-xx xx:xx:xx] Seems RTC has good time, write RTC time into system
[xxxx-xx-xx xx:xx:xx] Writing RTC time to system...
[2023-11-29 08:00:21] Done :-)
[2023-11-29 08:00:21] Firmware ID: 0x00
[2023-11-29 08:00:21] Firmware Revison: 0x05
[2023-11-29 08:00:21] Current Vout=5.04V, Iout=0A
[2023-11-29 08:00:21] System starts up because scheduled startup is due.
[2023-11-29 08:00:26] Send out the SYS_UP signal via GPIO-17 pin.
[2023-11-29 08:00:26] File "schedule.wpi" not found, skip running schedule script.
[2023-11-29 08:00:26] Pending for incoming shutdown command...
[xxxx-xx-xx xx:xx:xx] Witty Pi daemon (v4.13) is started.
[xxxx-xx-xx xx:xx:xx] Running on Raspberry Pi 3 Model A Plus Rev 1.0
[xxxx-xx-xx xx:xx:xx] Seems RTC has good time, write RTC time into system
[xxxx-xx-xx xx:xx:xx] Writing RTC time to system...
[2023-11-29 08:30:20] Done :-)
[2023-11-29 08:30:20] Firmware ID: 0x00
[2023-11-29 08:30:20] Firmware Revison: 0x05
[2023-11-29 08:30:20] Current Vout=5.04V, Iout=0A
[2023-11-29 08:30:20] System starts up because scheduled startup is due.
[2023-11-29 08:30:25] Send out the SYS_UP signal via GPIO-17 pin.
[2023-11-29 08:30:25] File "schedule.wpi" not found, skip running schedule script.
[2023-11-29 08:30:25] Pending for incoming shutdown command...
 
Posted : 29/11/2023 11:39 am
(@admin)
Posts: 479
Member Admin
 

You are using your own software (the second script) for scheduling, so the wittyPi.log doesn't include useful information for analysis such issue (don't see which time was actually scheduled).

The log from the second script does say it was scheduled at "2023-11-29 09:00:00", but the second script is not implemented by us, and we don't know if it was really scheduled succesfully.

You are welcome to implement your software, but we do not provide support on debugging your own software.

 

 
Posted : 29/11/2023 2:00 pm
(@anetmo)
Posts: 7
Active Member
 

What I don't understand is that the script checks that the time on the Witty is correct:

    while True:
        if(writeWitty(dateNext)):
            if(readWritty(dateNext)):
                break
        else:
            break

The writeWitty function modifies the Witty alarm via SMBus :

def writeWitty(date):
    try:
        with SMBus(1) as bus:
            bus.write_byte_data(0x08, 27, dec2bcd(0))
            bus.write_byte_data(0x08, 28, dec2bcd(date.strftime('%M')))
            bus.write_byte_data(0x08, 29, dec2bcd(date.strftime('%H')))
            bus.write_byte_data(0x08, 30, dec2bcd(date.strftime('%d')))
        log("INFO", "Next startup scheduled at "+date.strftime('%Y-%m-%d %H:%M:%S'))
        return True
    except Exception as e:
        log("ERROR", "schedueNextStartup - Write RTC : "+str(e))
        return False

And the readWitty function checks whether the alarm is set correctly :

def readWritty(date):
    try:
        with SMBus(1) as bus:
            s = bcd2dec(bus.read_byte_data(0x08, 27))
            m = bcd2dec(bus.read_byte_data(0x08, 28))
            h = bcd2dec(bus.read_byte_data(0x08, 29))
            d = bcd2dec(bus.read_byte_data(0x08, 30))

        if(s != 0):
            log("WARNING", "Ecriture Witty : S different : "+str(s)+" au lieu de "+0)
            return False
        if(m != int(date.strftime("%M"))):
            log("WARNING", "Ecriture Witty : M different : "+str(m)+" au lieu de "+date.strftime("%M"))
            return False
        if(h != int(date.strftime("%H"))):
            log("WARNING", "Ecriture Witty : H different : "+str(h)+" au lieu de "+date.strftime("%H"))
            return False
        if(d != int(date.strftime("%d"))):
            log("WARNING", "Ecriture Witty : D different : "+str(d)+" au lieu de "+date.strftime("%d"))
            return False
        return True
    except Exception as e:
        log("ERROR", "scheduleNextStartup - Read RTC : "+str(e))
        return False

 

So, the script doesn't seem to be the cause of the problem and seems to set the time on the Witty alarm correctly

 

 

 
Posted : 29/11/2023 2:25 pm
(@insideoutgrp)
Posts: 9
Active Member
 

We have a similar problem to this - we have our devices set to do a reboot (off for 15 mins, back on again)

95% of the time this works fine but sometimes they shut down and never boot back up.

Looking in the logs it's like the don't shut down correctly? But shouldn't the wittypi cut the power completely after a certain amount of time?

When power cycled the systems come back on no problem

 
Posted : 11/12/2023 10:52 am
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.