My PI3b does not survive over night - it is somehow lost in WLAN :-)

Whenever I am trying to login to Openhabian2.2 on next day my PI3b isn´t connected anymore.

I just checked openhab.log and it shows me latest action this morning at 07:11, when I tried to reach via putty at 09:15, I realized in Fritzbox that the PI wasn´t connected to WLAN any longer. So I restartet at 09:17

And this is happening each time when PI is alone for some hours - what can I do?
No special setting in FRITZbox for energy saving, no special setting in Openhabian because I am a beginner and I even wouldn´t know how:slight_smile:

2018-02-24 19:08:51.915 [WARN ] [l.serialmessage.SendDataMessageClass] - NODE 5: Already processed another send data request for this callback Id, ignoring.
2018-02-25 07:11:25.046 [WARN ] [l.serialmessage.SendDataMessageClass] - NODE 5: Already processed another send data request for this callback Id, ignoring.
2018-02-25 09:17:29.784 [INFO ] [er.internal.HomeBuilderDashboardTile] - Started Home Builder at /homebuilder

Can you connect via LAN?

I didn´t try, you mean when I acannot access via WLAN just plug it to LAN, would that work, that PI will get a new IP when not available on WLAN?
OK I will try next time.

But I intend to use the PI via WLAN for security purposes - if not stable in WLAN this is not a good choice!

Can you see in the log anything of value what could explain this?

Thanks a lot

Huh?

Do you somehow mix up LAN & WLAN?

If you just have the smallest possibility to use LAN, use it. The single pro for WLAN is not having to use a cable. In all other topics (including security) , WLAN is far inferior to LAN.

I am still in the trial and error period, pure beginner and lucky to get the first stupid sitemap running.

I do have multiple WLAN CAMs and Monitors running all without loosing signal and not reachable anymore when running over night - this lasts over years now!

Completely agree LAN is better but I am just surprised and asking myself is this the PI3b what isn´t trustful WLAN hardware or is it maybe something else, and maybe you guys know? As I mentioned when this happens the PI just dissapears from the Fritzbox connected device list - that surprises me.

as the Pi is meant to run as a Server mainly in LAN, you have to tell him to not powersave, if connected to WiFi:

as it’s a Linux system: iw wlan0 get power_save, it should then return if it’s on or off (If your Wifi is wlan0)

[14:23:43] openhabian@openHAB2:~$ iw wlan0 get power_save
Power save: off

to disable it, type sudo iw wlan0 set power_save off - but as that’s only temporarily until the next reboot, you should make it permanent. I didn’t found out how to do this in raspbian stretch (as you shouldn’t touch /etc/network/interfaces), so I just added the iw wlan0 set power_save OFF to my /etc/rc.local.

This is it!

Und wieso sagt das keiner :smile:

So this means per default power save is ON (You missed the sudo)
image

One last thing - I found that rc.local and because I have no real experience with Linux …
should it then look like this, or how should I add it?

Now it looks like this - Much better

image

sudo nano /etc/network/interfaces
Find the wlan0 section and add “wireless-power off” below it:

allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
wireless-power off

save and reboot

type in iwconfig and you should see that the Power Management is off now.

So I got this nano thing and this looks like 1980 Word Perfect :slight_smile: no idea how to navigate or how to use ^V (just is writing on the screen) - I think I am not a favorite of nano.

I will try doing it my way using Filezilla to download, edit and upload again

But this file looks quite empty maybe it is another file?
And interfaces.d is an directory which is empty

image

You’ll only need sudo for the set part, get doesn’t need it.

That’s not used anymore in raspbian stretch. Like I said don’t know how to do it “the right way” searched the whole internet and beyond for it… :sunglasses:

Try “vi” the next time! :joy:

Just add the line (no sudo needed here) at the bottom. It’s the dirty way, but works for now

Hi Thomas,

I tried it but I cannot copy the file back to the PI, I think file authorizations, and Icannot change the file authorizations in filezilla - what command to be used in putty to change the file authorization for local.rc ?

vi or nano…

sudo nano /etc/rc.local

Cursor moves with arrows. Just add it at the bottom.
http://www.codexpedia.com/text-editor/nano-text-editor-command-cheatsheet/

PS:

Please never try this again. There’s a reason why those files are root only! :thinking::drooling_face:

OK, Thanks a lot

but coming back to my original problem, this morning (WLAN energy save OFF) PI isn´t reachable, only restart helps. Green LED wasn´t blinking.
Any idea what I can check here - is your PI3b stable?

so far, I have three Pi generations stable with openHAB2:

  • Pi 1
  • Pi 2B
  • Pi 3B

they’re mainly on eth0, though… But Pi 2B and Pi1 were WiFi for some time (and stable for a couple days while testing)…? Are you using DHCP? oder static IP? I’m using Fritzbox also. Can you try with LAN?

Here is the “propper” stretch/systemd way to do it.

not quite! :wink:
The author himself says so (presently the last comment):

This was written against a PI running a version of Raspbian from 2016. I can’t guarantee it will work with newer releases of the OS.

He can’t gurarantee it but I’m currently doing almost the exact same thing and can say it works just fine on jessie.

I’ve written .service files exactly like this and they run just fine on stretch. There are a lot of changes between the two, but the syntax of .service files is not one of them.

Here is one I use to run sensorReporter:

[Unit]
Description=Reports status and sensor readings over MQTT and REST
Requires=networking.service
Wants=network-online.target
After=network.target network-online.target

[Service]
WorkingDirectory=/opt/sensorReporter
User=sensorReporter
Type=simple
ExecStart=/opt/sensorReporter/sensorReporter.py /opt/sensorReporter/sensorReporter.ini

[Install]
WantedBy=multi-user.target

compared to

[Unit]
Description=My Script Service
After=multi-user.target
 
[Service]
Type=idle
ExecStart=/home/pi/script.sh
 
[Install]
WantedBy=multi-user.target

The differences are mainly optional or deal with the fact that I run my script as a user other than root and need my script to wait for other services to be available before it executes.

And I should add that I’ve been running with the exact same .service file since jessie without changes.