Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

farm-urban/fufarm_haos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 

Repository files navigation

ha_sensors

This repository is used to provision a Raspberry Pi with a Home Assistant installation for monitoring and controlling Farm Urban Edible Walls.

The Raspberry Pi requires an Arduino Shield for attaching the sensors:

Installation of the Base Home Assistant OS and DFRobot sensors

There are currently issues with the network manager interface when using external wifi. One bug is described here: home-assistant/supervisor#4383 (comment)

Another issue that we encountered was that the wifi connection disconnects and is then disabled and needs to be manually renabled.

Potentially this bug: home-assistant/supervisor#3674 home-assistant/operating-system#2720

For this reason, we've had to ditch the HA OS and will use a standard Linux OS on the RPI and add the HA Supervisor.

  • Use the Raspberry Pi Imager to flash an SD card with the Home Assistant OS.
  • Insert SD card and second USB wifi dongle into the pi.
  • On OSX: System Preferences -> Sharing -> Internet Sharing: On
  • Plug ethernet cable into Mac and the Raspberry Pi.
  • Go to: http://homeassistant.local:8123/ and do basic setup (user: fu)
  • Go to user settings and enable Advanced Mode.
  • Settings -> Add-ons -> ADD-ON STORE
    • Install Advanced SSH Addon and set username and authorized_keys. Turn off the Protected Mode for the addon (required to accces docker on the installation).
    • Install Tailscale, start the addon, and look in the logs to the the authorisation url, go there and authenticate.

Network and AP setup

  • Settings -> System -> Network:
    • Set USB wifi card (WLP1SOU1U2) to IP4 to automatic. We use this for the connection to the Wifi as it doesn't support AP mode so we use the internal card as the AP (see tasks\setup_ap.yml)

Setup installation using the Ansible script

  • Install ansible on the host machine.
  • Edit the ansible files in the ansible directory to set:
    • The MAC/HOSTNAME/IP for the ip camera and plugs in tasks/setup_ap.yml
    • Edit files//mqtt.yml to set which sensors are present.
  • Run the ansible script in the ansible directory of this repository with: ansible-playbook -i 100.76.171.127, ha.yml

Final manual stup

  • Goto Settings -> Devices & Services and click to automatically configure MQTT

Setup of Tapo Webcam

  • the addon is setup by the ansible script.
  • create a camera account on the camera with the Tapo app (Camera -> Device Settings -> Advanced Settings -> Camera Account).
  • add the webcam to the network using the Tapo app.
  • If the above doesn't work: Devices and Services -> Add Integration -> Tapo: Cameras Control

USB Webcam

Creating the addon Docker Image

  • Checkout https://github.com/linucks/fu_sensors to build the docker image (if updating)
  • Edit the build.sh to set the SENSOR_DIR variable to the location of the above repository.
  • Run the build.sh script to build and upload the Docker image to github.

Power Plugs

Wifi

  • Find a USB wifi dongle that is natively supported by HA (https://github.com/morrownr/USB-WiFi) - this means that it has an in-kernel driver, and supports AP mode.
  • Decided on 2.4GHz model from the Pi Hut, this has a supported driver but doesn't support AP mode, so this is used for for Pi to connect to the Wifi, and the internal USB card serves as the AP.
  • Could try Panda PAU03 - might have in kernel driver and support AP mode.

Zigbee

Random Stuff

Cheap plugs but unsure if suitable

Networking

To configure the connection for a wifi not present at setup:

MQTT

Security

Useful Commands

  • Enter shell on container: docker exec -it $(docker container ls | grep rpi-ardcli | cut -f1 -d " ") /bin/sh
  • Manually set network parameters: `ha network update wlan0 --ipv4-method auto --wifi-auth wpa-psk --wifi-mode infrastructure --wifi-ssid 'FARMURBAN' --wifi-psk 'XXX'``
  • Network on the pi: nmcli con show
  • Getting the slug for an addon: ha addons
  • Getting options for an addon from the command-line:
curl \
-sSL \
-H "Authorization: Bearer $SUPERVISOR_TOKEN" \
http://supervisor/addons/30e576d0_hassio-access-point/info \
| jq
curl  \
-sSL  \
-H "Authorization: Bearer $SUPERVISOR_TOKEN"  \
-X POST  \
http://supervisor/addons/30e576d0_hassio-access-point/options  \
-d '{"options": {"addon_option1": 1, "addon_option2": 2}'


About

Repository for Home Assistant Sensors

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published