Media PC

zbox – ATOM 1.8GHz processor, 250Gb Disk, DVD drive,

  • Install Debian 10.4 from minimal install disk
  • Install Dependencies (https://www.mythtv.org/wiki/Build_from_Source#Installing_Build_Dependencies_without_Ansible)
  • Create packages (https://www.mythtv.org/wiki/Installing_MythTV_on_Debian)
  • Install packages
  • Update config.xml
  • Config Audio to use HDMI
  • Fix VDPAU Driver – installĀ  contrib/non-free (nvidia-legacy-340xx-driver) [https://wiki.debian.org/NvidiaGraphicsDrivers]
  • Install lirc, update /home/mythtv/.mythtv/lircrc
  • Install samba client for /shared directory

TODO:

  • Mount shared, scan for videos
  • Install plugins
  • Speed up boot / shutdown (use Suspend?)
  • Fix suspend pop up
  • Backup settings to /shared/backups/zbox
    • lircrc
    • etc

Sonoff Mini

Set up web server on Macbook (https://github.com/arendst/Tasmota/wiki/Mac-OSX-Local-Web-Server-for-Tasmota-Firmware-Binaries)

Copy 8285 bin file to /Library/WebServer/Documents

Calculate shasum: d5a654253f1ca5c4d170c0ae80902fd88b2deee13cd13835e65e94753a412f8c

Put Mini in DIY mode

Create HotSpot: sonoffDiy/20170618sn

Discover Device ID: dns-sd -B _ewelink._tcp

Test Connection: curl http://<deviceIP>:8081/zeroconf/info -XPOST –data ‘{“deviceid”:”<deviceID>”,”data”:{} }’

Unlock : curl http://<deviceIP>:8081/zeroconf/ota_unlock -XPOST –data ‘{“deviceid”:”<deviceID>”,”data”:{} }’

Flash Firmware: curl http://<deviceIP>:8081/zeroconf/ota_flash -XPOST –data ‘{“deviceid”:”<deviceID>”,”data”:{“downloadUrl”: “http://192.168.1.65/ESP_20191208.bin”, “sha256sum”: “d5a654253f1ca5c4d170c0ae80902fd88b2deee13cd13835e65e94753a412f8c”} }’

Fails – replacing with Tasomata firmware works.

 

Raspberry Pi – Lofty

  • Install Raspbian – lite + add ssh file to /boot
  • Update password, change hostname
  • Use raspi-config to expand partition size (reboot)
  • Update System, disable BT & WIFI
  • Install Mythtv-light, Mariadb, apache2
  • Move DB to USB disk
  • Add Storage Groups
  • Import Old recordings

 

Switch-Pi

  • Burn latest img to SD Card
  • Connect using Keyboard + HDMI, change password
  • Update network settings to use DHCP (dhcpd.conf), update hostname +hosts
  • Use raspi-config to expand partition size
  • reboot, connect using ssh
  • Use raspi-config to upgrade stuff
  • Add sipgate, localphone, freespeech as Voip External Lines
  • Add mobile & gigaset as extensions
  • Add basic Outgoing Call Routing
  • (Update and Upgrade packages)
  • Install g729 (https://techfoxweb.wordpress.com/2017/02/23/g729-raspbx-in-raspberry-pi-3/)
  • Install ddclient & add freedns domains, add ‘externhost’ to sip.conf
  • Install samba, create /srv/ binds to /etc/asterisk /home/backups
  • Install Oak R2 board, get PSTN incoming working
  • Upgrade and rebuild dahdi
  • install fail2ban

TODO:

  • Create least cost routing
  • Add Contacts to DB
  • Filter incoming calls using contacts

Sonoff Basic

To load with EasyESP:

      • Open Unit
      • Solder 4 pin header to serial header
      • Connect USB to Serial cable to header
      • Close Case
      • Hold down button and Connect Power In
      • Using latest firmware run esptool.py:

sudo python esptool.py --baud 115200 --port /dev/tty.usbserial-FT2IXHL0 write_flash -fm dout 0x0000 ../20191130/bin/ESP_Easy_mega-20191130_normal_ESP8285_1M.bin

      • Power off unit
      • Open case
      • Remove serial cable from header
      • Close Case
      • Power On
      • Change WIFI to ESP_Easy_0 (password: configesp)
      • Configure Unit

Rebuild System

Reinstall OpenHab: OpenHab
Update Passwords
Install: Mosquitto & Influxdb & Grafana
Change Influxdb to be located on USB stick
Update udev rules to map serial ports
Add permissions in /etc/defaults/
Install zigbee2mqtt zigbee2mqtt
Install bindings (net, mqtt, gpio, onewiregpio, serial), transforms (jsonpath, regex, scale, map),

Temperature and Humidity in Utility

Need to directly connect a BME280 to the Raspberry Pi, so stacked a header below the 1-wire header, and followed instructions here to get drivers working.

Frustratingly needed to update /etc/modules to get i2c-dev to load on boot.

In hindsight probably should have linked the sensor into the Arduino UNO instead.

Water Tank Sensors

The Pi running OpenHab is directly below the hot water tank, so rather than adding another wireless node in the airing cupboard, I can run some wired sensors.

Simplest for this purpose is a bunch of DS18B20 sensors, these use a 1-wire protocol which is capable of going the 3-4metre distance. Also only need a three wire cable to connect all the sensors. Used an old mini-circuits box to connect the three sensor cables together with 5kohm resistor pull up in the airing cupboard.

Follow instructions @ https://community.openhab.org/t/gpio-1-wire-temp-sensors-on-raspberry-pi-with-openhabian/20941

On the Pi added the following to /boot/config.txt

# PS - Enable 1-wire sensors
dtoverlay=w1-gpio,gpiopin=4

Use the onewiregpio binding in openhab to retrieve the temperature info, add the three sensors with manually created 1wire.thing:

Thing onewiregpio:sensor:Water_Temperature_1 "Water Temperature 1" [gpio_bus_file="/sys/bus/w1/devices/28-01143f865eaa/w1_slave",refresh_time=10]
Thing onewiregpio:sensor:Water_Temperature_2 "Water Temperature 2" [gpio_bus_file="/sys/bus/w1/devices/28-01143f8d57aa/w1_slave",refresh_time=10]
Thing onewiregpio:sensor:Water_Temperature_3 "Water Temperature 3" [gpio_bus_file="/sys/bus/w1/devices/28-01143d7bdcaa/w1_slave",refresh_time=10]

1wire.items

Number:Temperature Water_Temperature_1      "Temperature: [%.2f %unit%]" <temperature>  { channel="onewiregpio:sensor:Water_Temperature_1:temperature" }
Number:Temperature Water_Temperature_2      "Temperature: [%.2f %unit%]" <temperature>  { channel="onewiregpio:sensor:Water_Temperature_2:temperature" }
Number:Temperature Water_Temperature_3      "Temperature: [%.2f %unit%]" <temperature>  { channel="onewiregpio:sensor:Water_Temperature_3:temperature" }

Self Build Temperature Sensor

First pass, using NodeMCU and sensor, powered via USB charger. Since a lot of the wireless technology is based on the ESP SOC this would be a good development platform to experiment with, so worth getting one to play with.

Start with a NodeMCU, a simple Temperature Sensor and one of the many USB power bricks lying around the house.

Solder (badly) the BME280 to a four core cable with a couple of two pin header connectors (GND, 3.3V) & (SCL, SDA) on the end. Connect to the pins on the NodeMCU (GND, 3.3V) & (D4, D5).

Install ESPEasy and configure it to have one BME280 device, connected using MQTT ultimately to OpenHAB. In the meantime tested connectivity by installing Mosquitto on my server. Named the ESP in the living room: “Lounge” and the BME280 sensor “Sensor”:

mosquitto_sub -v -t "/Lounge/Sensor/#"
/Lounge/Sensor/status/LWT Connected
/Lounge/Sensor/Temperature 16.24
/Lounge/Sensor/Humidity 54.18
/Lounge/Sensor/Pressure 1021.65

Too easy, but pretty ugly, with a USB charger hanging out of the wall socket.

Build two more using D1 mini boards, soldering the wires direct to the through hole vias. Deploy one as ‘BigShed’ and the other as ‘TopRoom’.

TODO:

Mixed fleet of sensors:

BME280 Based to get Humidity:

  • Utility Room – Attached directly to Pi/Uno
  • Main Bathroom – Attached to NodeMCU
  • Ensuite – Attached to same NodeMCU as Bathroom
  • Kitchen?
  • Shed to get outside humidity & pressure

DS18B20 Based to just get Temperature, all attached to same NodeMCU (possibly split Bedroom 4 & Loft off to a separate Node):

  • Bedroom 1
  • Bedroom 2
  • Bedroom 3
  • Bedroom 4
  • Bedroom 5
  • Loft Room
  • Landing

Water Tank is monitored by a group of DS18B20 encapsulated sensors, attached directly to the Pi.

Downstairs experiment with ZigBee, this distribution would normally provide a good adhoc network, but not sure the sensors support this. So probably need a ZigBee router:

  • Lounge
  • Study
  • Hall

To Support this deployment need to get:

  • 3 ZigBee Sensors
  • 1 Zigbee Router
  • 4 NodeMCUs (already got)
  • 3 (SPI) BME280 Sensors (already got)
  • 2 (I2C) BME280 Sensors
  • 10 DS18B20 Sensors (already got 3 for water tank)