The following project is done using the hassio OS which can be downloaded in the link below:
Installation:https://www.home-assistant.io/hassio/installation/
download the image for raspberry pi 3B, format a SD card and write the image using any tool such as Balena, windows disk imager etc.
The link for balena etcher is below:
after writing the image, take a usb drive, format it with the drive name CONFIG, create a folder named network, inside the folder create a empty file name my-network open the same and copy paste any one of the code in the link given below:
https://github.com/home-assistant/hassos/blob/dev/Documentation/network.md
plug the pendrive and sd card on to the Rpi, boot the pi wait for the pi to load the OS
OS deployment:
Go to http://hassio.local:8123/ in your PC browser
you should see a image like below:
Then after 20 minutes the webserver should be up and running as below:
Create a username and password and click next the dashboard must be visible to you now
Navigate to hass.io
- Go to add ons
 - Click on configurator
 - Click on install and start
 - Open web ui
 - in the configurator.yaml file deploy the code given below
 
homeassistant:
 # Name of the location where Home Assistant is running
 name: Home
 # Location required to calculate the time the sun rises and sets
 latitude: 10.991
 longitude: 76.9667
 # Impacts weather/sunrise data (altitude above sea level in meters)
 elevation: 0
 # metric for Metric, imperial for Imperial
 unit_system: metric
 # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
 time_zone: Asia/Kolkata
 # Customization file
 customize: !include customize.yaml
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123
# Discover some devices automatically
discovery:
# Sensors
sensor:
 # Weather prediction
 - platform: yr
# Text to speech
tts:
 - platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
switch:
 - platform: rpi_gpio
   ports:
     16: Light row 3
     20: Light row 1
     21: Light row 2
     26: Light row 4
sensor:
 - platform: history_stats
   name: Light On Today
   entity_id: switch.light_row_1
   state: 'on'
   type: time
   start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
   duration:
     hours: 24
Connect the four channel relay board to the RPi in the pins 16, 20, 21, 26 as below:
Click save file -> Go to Configuration -> In general click check config -> after configuration valid message click restart.
On successful restart switch on and off the relay's, it should be working perfectly.
Thanks














Comments