Helpdesk

On my raspberry bullseye I mounted the strompi3 using a 9V battery as Wide.


Strompi has the 2025 firmware after flashing it.


Try to get RTC_SerialShutdown_EMail.py active after boot without succes. Tried rc.local, crontab without success. It fails due an in(data) error.
Latest attempt is following your document to create a service in systemctl/systemd.


After boot the service failed to start. But starting it after boot from the commandline it is active but requires a password for user pi.


login in and it is working fine. Get emails after powerloss en -recovery. In your document you do not mention that a password is asked for.


So I think that the password requiry is causing the service to fail duren reboot.


Any suggestions?

Quiebus

31.08.26 10:33

Thank you for your detailed feedback.


We have checked the systemd autostart procedure and made a small adjustment to our quick start guide.


We have added the following line to the service configuration:


WorkingDirectory=/home/pi/StromPi3_Scriptfolder_2025-07-18

During our tests, the StromPi3 service starts automatically after boot without requiring any password input.


Please note that we have currently tested this only with the latest Raspberry Pi OS version based on Trixie. We have not yet verified the behavior specifically under Raspberry Pi OS Bullseye.


We therefore recommend adding the WorkingDirectory line to your service configuration and testing the autostart again.


If the issue still persists, we recommend updating to the latest Raspberry Pi OS Trixie version and testing the service again.


Best regards


Tim (Joy-IT)

Tim

31.08.26 13:57

Thanks for the suggestions.


Adding the workdirectory to the service helps indeed for skippen the login screen. When I start the service from the commandline it works.


But when I reboot the service remains inactive, so there is another reason why its not active after reboot.


Did not updat my raspberry os to trixy yet. Have to check if my application Domoticz supports trixy.

Quiebus

31.08.26 14:41

I now checked journalctl -u StromPi3.service en noticed that the problem is that the shutdown email script is running in error with socket.gaierror [Errni -3] Temporary failure in nameresolution. 
strange that thus not happens when starting the service from the commandline and its identical with earlier attempt with rc.local and crontab.

Quiebus

31.08.26 15:01

Thank you for the additional information.


The error could indicate that the service is started before the network is fully available.


Please add the following two lines to the [Unit] section:


 

Wants=network-online.target
After=network-online.target

This should delay the StromPi3 service until the network is fully available


Best regards


Tim (Joy-IT)

Tim

31.08.26 15:11

Seemed related to the SendMail part in the RTC script en socket.py and smtplib.py.

Quiebus

31.08.26 15:21

Still getting StromPi3.service failed with the same Temporary failure in name resolution

Quiebus

31.08.26 15:39

The journal part of the last attempt


aug 31 14:52:19 raspberrypi python3[406]: The date und time has been synced: StromPi -> Raspberry Pi
aug 31 14:52:19 raspberrypi python3[406]: -----------------------------------------
aug 31 14:52:19 raspberrypi python3[406]: Traceback (most recent call last):
aug 31 14:52:19 raspberrypi python3[406]:   File "/home/pi/StromPiScripts-2025/Serial/RTC_SerialShutdown_EMail2.py", lin>
aug 31 14:52:19 raspberrypi python3[406]:     Sendmail_Restart()
aug 31 14:52:19 raspberrypi python3[406]:   File "/home/pi/StromPiScripts-2025/Serial/RTC_SerialShutdown_EMail2.py", lin>aug 31 14:52:19 raspberrypi python3[406]: The date und time has been synced: StromPi -> Raspberry Pi
aug 31 14:52:19 raspberrypi python3[406]: -----------------------------------------
aug 31 14:52:19 raspberrypi python3[406]: Traceback (most recent call last):
aug 31 14:52:19 raspberrypi python3[406]:   File "/home/pi/StromPiScripts-2025/Serial/RTC_SerialShutdown_EMail2.py", lin>
aug 31 14:52:19 raspberrypi python3[406]:     Sendmail_Restart()
aug 31 14:52:19 raspberrypi python3[406]:   File "/home/pi/StromPiScripts-2025/Serial/RTC_SerialShutdown_EMail2.py", lin>
aug 31 14:52:19 raspberrypi python3[406]:     session = smtplib.SMTP(SERVER, PORT)
aug 31 14:52:19 raspberrypi python3[406]:   File "/usr/lib/python3.9/smtplib.py", line 253, in __init__
aug 31 14:52:19 raspberrypi python3[406]:     (code, msg) = self.connect(host, port)
aug 31 14:52:19 raspberrypi python3[406]:   File "/usr/lib/python3.9/smtplib.py", line 339, in connect
aug 31 14:52:19 raspberrypi python3[406]:     self.sock = self._get_socket(host, port, self.timeout)
aug 31 14:52:19 raspberrypi python3[406]:   File "/usr/lib/python3.9/smtplib.py", line 310, in _get_socket
aug 31 14:52:19 raspberrypi python3[406]:     return socket.create_connection((host, port), timeout,
aug 31 14:52:19 raspberrypi python3[406]:   File "/usr/lib/python3.9/socket.py", line 822, in create_connection
aug 31 14:52:19 raspberrypi python3[406]:     for res in getaddrinfo(host, port, 0, SOCK_STREAM):
aug 31 14:52:19 raspberrypi python3[406]:   File "/usr/lib/python3.9/socket.py", line 953, in getaddrinfo
aug 31 14:52:19 raspberrypi python3[406]:     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
aug 31 14:52:19 raspberrypi python3[406]: socket.gaierror: [Errno -3] Temporary failure in name resolution
aug 31 14:52:19 raspberrypi systemd[1]: StromPi3.service: Main process exited, code=exited, status=1/FAILURE
aug 31 14:52:19 raspberrypi systemd[1]: StromPi3.service: Failed with result 'exit-code'.aug 31 14:52:19 raspberrypi python3[406]:     session = smtplib.SMTP(SERVER, PORT)
aug 31 14:52:19 raspberrypi python3[406]:   File "/usr/lib/python3.9/smtplib.py", line 253, in __init__
aug 31 14:52:19 raspberrypi python3[406]:     (code, msg) = self.connect(host, port)
aug 31 14:52:19 raspberrypi python3[406]:   File "/usr/lib/python3.9/smtplib.py", line 339, in connect
aug 31 14:52:19 raspberrypi python3[406]:     self.sock = self._get_socket(host, port, self.timeout)
aug 31 14:52:19 raspberrypi python3[406]:   File "/usr/lib/python3.9/smtplib.py", line 310, in _get_socket
aug 31 14:52:19 raspberrypi python3[406]:     return socket.create_connection((host, port), timeout,
aug 31 14:52:19 raspberrypi python3[406]:   File "/usr/lib/python3.9/socket.py", line 822, in create_connection
aug 31 14:52:19 raspberrypi python3[406]:     for res in getaddrinfo(host, port, 0, SOCK_STREAM):
aug 31 14:52:19 raspberrypi python3[406]:   File "/usr/lib/python3.9/socket.py", line 953, in getaddrinfo
aug 31 14:52:19 raspberrypi python3[406]:     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
aug 31 14:52:19 raspberrypi python3[406]: socket.gaierror: [Errno -3] Temporary failure in name resolution
aug 31 14:52:19 raspberrypi systemd[1]: StromPi3.service: Main process exited, code=exited, status=1/FAILURE
aug 31 14:52:19 raspberrypi systemd[1]: StromPi3.service: Failed with result 'exit-code'.

Quiebus

31.08.26 15:54

As a workaround, please try adding the following to the [Service] section


Restart=on-failure
RestartSec=10

 

This should automatically restart the StromPi3 service after 10 seconds if the initial start fails.


Best regards


Tim (Joy-IT)

Tim

31.08.26 17:11

Ok now it’s active after reboot and mail arrives after power fail and restore.


 


thank Tim for your effective support!

Quiebus

31.08.26 19:34

You can close this call since it has been solved.

Quiebus

01.09.26 19:57