Smart Home with raspi and openhabian

Pir was giving chaotic behavior. Do a pullup resistor.

When using the PIR widely available from ebay/ali/amazon, the internal pull-up Resistor doesn’t seem to work (and the device doesnt have a proper one either). In order to avoid completly chaotic behaviour (false positives) it is advisable to connect an external pull-up-Resistor between the GPIO and VCC (10KOhm).

https://www.letscontrolit.com/wiki/index.php?title=Switch

Using a Motion Detector on Raspberry Pi

OpenWRT Netgear WNR2200

OpenWrt Wiki page

https://oldwiki.archive.openwrt.org/toh/netgear/wnr2200

Get the package manager working

1)disable ipv6 to run updates as wget will return error 4 and you will not be able to opkg update

add option ipv6 0 to disable IPv6 for the network interface in /etc/config/network. Opkg works after restart.

alternatively, as per forum https://forum.archive.openwrt.org/viewtopic.php?id=60799

cd /etc/config
vi firewall
# Uncomment this line to disable ipv6 rules
        option disable_ipv6     1 
cd /etc/
vi sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1 

2)fix https

openwrt servers now redirect to https, so to use the default wget that does not support https, use an alternative mirror. If you had space, you could update wget to support https. with 8mb, you don’t, if you want to install anything else.

As outlined here https://forum.openwrt.org/t/opkg-update-error-wget-returned-4/637/6

add option ipv6 0 to disable IPv6 for the network interface in /etc/config/network. Opkg works after restart.

3)ssh, opkg update

External drive / storage with OpenWRT

If you want to use an external usb drive, you’re out of luck. Did not work for me. Pivot is done before USB scsi loads. Patches did not work. Gargoyles external packages kinda work.

https://openwrt.org/docs/guide-user/additional-software/extroot_configuration#new.external.overlay.variant.pivot.overlay

Unbricking OpenWRT Netgear WNR2200

Read both

https://openwrt.org/docs/guide-user/installation/generic.flashing.tftp

https://openwrt.org/toh/netgear/wnr2200

If you run out of free space or otherwise brick your router

Turn off, hold in the reset button, turn on, hold the reset button in till the led switches color. tftp your original image.

The tftp expect is rather short, so what worked for me is having tftp up and running on my GNU/Linux machine and having the router connected via Eth cable, laptop to port1 (ethernet, not the different colored one used for internet connection)and then hitting the reset cycle.

Otherwise I was getting timeouts.

 

TTY / TTL terminal connection

TTL the pins are allready on the board.

Make sure your usb adapter is set to 3.3 v and there is no need to connect +V, just Ground, TX and RX.

To connect in GNU/Linux

screen /dev/ttyUSB0 115200
screen /dev/ttyUSB0 115200,cs8,-ixon,-ixoff,-istrip

Audio feedback with a buzzer.

plus to TX, 0(minus) to Ground

a 12v active piezo buzzer ripped out of a salvaged alarm panel module provides a nice modem like buzz when the router booots and prints to screen. a 5v buzzer was giving a nasty hum. Easy way to hear your router boot and enjoy some dial-up nostalgia.