Homeassistant

From lechacal
Jump to: navigation, search

Homeassistant and RPICT unit on the same Raspberry Pi

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 (near line 64)

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. It can be left as is for testing first.

Click on the 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.

Troubleshooting

  • Beware that Homeassistant does not seem to work well with Firefox. Use another browser if you find it failing to open some pages.
  • hassos-boot volume is not always automatically mounted. Use your operating system disk manager to mount it manually.

Homeassistant and RPICT unit on a different host

We would recommend to use MQTT to forward the RPICT data other to Homeassistant. This Github source below will help you achieve that. https://github.com/ned-kelly/docker-lechacal-homeassistant

Credit to ned-kelly on Github for making this interface.

Related Links

https://www.home-assistant.io/integrations/serial/