Homeassistant

From lechacal
Revision as of 19:10, 16 October 2021 by Administrator (talk | contribs)
Jump to navigation Jump to search

Homeassistant on the same Raspberry Pi as the RPICT unit

Install the homeassistant image as explained on this page below.

https://www.home-assistant.io/installation/raspberrypi

Just before inserting the SD card in the raspberrypi open the hassos-boot volume on your computer. In there you will find a file called config.txt.

Open this file with a text editor and add the following line below at the end of the file:

dtoverlay=disable-bt

Also remove the # in front the line saying

enable_uart = 1

Save the file and unmount the SD card. Insert it in the Raspberrypi and go through the step asked on the web interface.

Find your name at the bottom left of the dashboard and enable Advanced Mode.

Then go to Supervisor | Add-on Store. Search for visual and install Visual Studio Code. Make sure you start it once installed and tick Show in sidebar on.

Go to Visual Studio Code from the left pane. Select the file called configuration.yaml. At the botton of this file add the following configuration:

sensor:
 - platform: serial
   name: "RPICT"
   serial_port: /dev/ttyAMA0
   baudrate: 38400

 - platform: template
   sensors:
     rpict_ct1:
       friendly_name: CT1
       unit_of_measurement: "W"
       value_template: "{{ states('sensor.RPICT').split(' ')[1] | float }}"
     rpict_ct2:
       friendly_name: CT2
       unit_of_measurement: "W"
       value_template: "{{ states('sensor.RPICT').split(' ')[2] | float }}"
     rpict_ct3:
       friendly_name: CT3
       unit_of_measurement: "W"
       value_template: "{{ states('sensor.RPICT').split(' ')[3] | float }}"

homeassistant:
 customize:
   sensor.rpict_ct1:
     icon: mdi:current-ac
   sensor.rpict_ct2:
     icon: mdi:current-ac
   sensor.rpict_ct3:
     icon: mdi:current-ac

The above configuration must be adapted to the RPICT board that you are using.

Click on teh 3 lines icon at the top left and select File -> Save.

Then got to Supervisor and select System from the top bar. Here hit RESTART CORE. Confirm the restart.

You can now go to Overview and the data will appear in the Sensor section.