Klaas Schoute 4406672e33 🚜 Merges/Redirect Sensehat platform pages (#9117)
* 🚜 Merges/Redirect Sensehat platform pages

* ✏️ Fix link

* ✏️ Tweak
2019-04-04 08:35:10 -04:00

5.4 KiB

layout, title, description, date, sidebar, comments, sharing, footer, logo, ha_category, ha_iot_class, ha_release, redirect_from
layout title description date sidebar comments sharing footer logo ha_category ha_iot_class ha_release redirect_from
page Sense HAT Instructions on how to setup Sense HAT LED lights within Home Assistant. 2017-04-29 16:00 true false true true sense-hat.png
DIY
Light
Sensor
Assumed State 0.44
/components/light.sensehat/
/components/sensor.sensehat/

There is currently support for the following device types within Home Assistant:

{% linkable_title Light %}

The sensehat light platform lets you control the Sense HAT board's 8x8 RGB LED matrix on your Raspberry Pi from within Home Assistant.

To add sensehat light to your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
light:
  - platform: sensehat

{% linkable_title Sensor %}

The sensehat sensor platform allows you to display information collected by a Sense HAT add-on board for Raspberry Pi.

To add this platform to your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
sensor:
  - platform: sensehat
    display_options:
      - temperature
      - humidity
      - pressure

{% configuration %} display_options: description: List of details to monitor. required: true default: "memory_free" type: list keys: temperature: description: Temperature humidity: description: Humidity pressure: description: Pressure name: description: Change the name of te sensor, for in the frontend. required: false type: string is_hat_attached: description: Declaring that the SenseHAT is physically on the Raspberry Pi. required: false default: true type: boolean {% endconfiguration %}

{% linkable_title Customizing the Sense HAT data %}

{% linkable_title Format the sensor values %}

Add the following to your sensor:

{% raw %}

# Example configuration.yaml entry
sensor:
  - platform: sensehat
    display_options:
        - temperature
        - humidity
        - pressure

  - platform: template
    sensors:
      sensehat_temperature:
        value_template: '{{ states.sensor.temperature.state | round(1) }}'
        unit_of_measurement: '°C'
      sensehat_pressure:
        value_template: '{{ states.sensor.pressure.state | round(1) }}'
        unit_of_measurement: 'mb'
      sensehat_humidity:
        value_template: '{{ states.sensor.humidity.state | round(1) }}'
        unit_of_measurement: '%'

{% endraw %}

{% linkable_title Give the values friendly names & icons %}

Add the following to your customize:

# Example configuration.yaml entry
customize:
  sensor.sensehat_temperature:
    icon: mdi:thermometer
    friendly_name: "Temperature"
  sensor.sensehat_humidity:
    icon: mdi:weather-rainy
    friendly_name: "Humidity"
  sensor.sensehat_pressure:
    icon: mdi:gauge
    friendly_name: "Pressure"

{% linkable_title Create a group %}

Add the following to your groups:

# Example configuration.yaml entry
group:
  sense_hat:
    name: Sense HAT
    entities:
      - sensor.sensehat_temperature
      - sensor.sensehat_humidity
      - sensor.sensehat_pressure

Add the sense_hat group (Kitchen for example)

# Example configuration.yaml entry
group:
  kitchen:
    - group.sense_hat

{% linkable_title Directions for installing on Raspberry Pi All-In-One installer and HASSbian: %}

Here are the steps to make the SenseHAT sensor work successfully with the virtual environment versions.

{% linkable_title Install SenseHAT package to homeassistant_venv %}

# switch to the homeassistant_venv environment
sudo -u homeassistant -H -s
source /srv/homeassistant/homeassistant_venv/bin/activate

# install the sense-hat lib
pip3 install sense-hat
# be patient, this will take a long while

{% linkable_title Return to pi %}

Type exit to quit out of the homeassistant_venv back to your pi environment.

As all of the following steps should be under the pi user environment.

{% linkable_title Install RTIMU %}

# pi user environment: Install RTIMU
pip3 install rtimulib

# pi user environment: Add _homeassistant_ user to the _input_, _video_ and the _i2c_ groups
sudo addgroup homeassistant input
sudo addgroup homeassistant i2c
sudo addgroup homeassistant video

# HA environment: Add symlink to RTIMU
ln -s /usr/lib/python3/dist-packages/RTIMU.cpython-35m-arm-linux-gnueabihf.so /srv/homeassistant/lib/python3.5/site-packages/

# pi user environment: Reboot Raspberry Pi to apply changes
sudo reboot

Unfortunately enabling the SenseHAT Sensor component for a Virtual Environment install of Home Assistant fails with errors. (The Raspberry Pi All-In-One installer and HASSbian both run Home Assistant in an virtual environment). These issues have been discussed in the repository issue #5093

This fix has been tested with a clean install of:

and

For setting up the Sense HAT's RGB LED matrix as lights within Home Assistant, please see the Sense HAT light component.