Homeassistant: Difference between revisions
No edit summary |
No edit summary |
||
Line 19: | Line 19: | ||
Then go to '''Supervisor''' | '''Add-on Store'''. Search for visual and install '''Visual Studio Code'''. | 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. | 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: | |||
hidden: true | |||
sensor.rpict_ct1: | |||
icon: mdi:current-ac |
Revision as of 19:03, 16 October 2021
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: hidden: true sensor.rpict_ct1: icon: mdi:current-ac