Skip to content

Commit 779fdea

Browse files
nodinosaurfabaff
authored andcommitted
Update to components/sensor.sensehat (home-assistant#2009)
* Update to components/sensor.sensehat • Have provided more information on how to install the SenseHAT for Virtual Environment installs • Have included directions on making the SenseHAT prettier * Amends to comform with PR
1 parent 5dcb6fb commit 779fdea

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed

source/_components/sensor.sensehat.markdown

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,116 @@ Configuration variables:
3636
- 'pressure'
3737

3838

39+
#### Customizing the Sense HAT data
40+
41+
**Format the sensor values**
42+
Add the following to your `sensor`
43+
44+
```yaml
45+
# Example configuration.yaml entry
46+
sensor:
47+
- platform: sensehat
48+
display_options:
49+
- temperature
50+
- humidity
51+
- pressure
52+
53+
- platform: template
54+
sensors:
55+
sensehat_temperature:
56+
value_template: '{% raw %}{{ states.sensor.temperature.state | round(1) }}{% endraw %}'
57+
unit_of_measurement: '°C'
58+
sensehat_pressure:
59+
value_template: '{% raw %}{{ states.sensor.pressure.state | round(1) }}{% endraw %}'
60+
unit_of_measurement: 'mb'
61+
sensehat_humidity:
62+
value_template: '{% raw %}{{ states.sensor.humidity.state | round(1) }}{% endraw %}'
63+
unit_of_measurement: '%'
64+
```
65+
66+
**Give the values friendly names & icons**
67+
Add the following to your `customize`
68+
69+
```yaml
70+
# Example configuration.yaml entry
71+
customize:
72+
sensor.sensehat_temperature:
73+
icon: mdi:thermometer
74+
friendly_name: "Temperature"
75+
sensor.sensehat_humidity:
76+
icon: mdi:weather-rainy
77+
friendly_name: "Humidity"
78+
sensor.sensehat_pressure:
79+
icon: mdi:gauge
80+
friendly_name: "Pressure"
81+
```
82+
83+
**Create a group**
84+
Add the following to your `groups`
85+
86+
```yaml
87+
# Example configuration.yaml entry
88+
group:
89+
sense_hat:
90+
name: Sense HAT
91+
entities:
92+
- sensor.sensehat_temperature
93+
- sensor.sensehat_humidity
94+
- sensor.sensehat_pressure
95+
```
96+
Add the _sense_hat group_ a group (_Kitchen for example_)
97+
```yaml
98+
# Example configuration.yaml entry
99+
group:
100+
kitchen:
101+
- group.sense_hat
102+
```
103+
104+
105+
### Directions for installing on Raspberry Pi All-In-One installer and HASSbian:
106+
Here are the steps to make the _SenseHAT_ sensor work _successfully_ with the virtual enviroment versions.
107+
108+
#### Install SenseHAT package to _homeassistant_venv_
109+
```bash
110+
# switch to the homeassistant_venv environment
111+
sudo su -s /bin/bash homeassistant
112+
source /srv/homeassistant/homeassistant_venv/bin/activate
113+
114+
# install the sense-hat lib
115+
pip3 install sense-hat
116+
# be patient, this will take a long while
117+
```
118+
#### Return to `pi`
119+
Type `exit` to quit out of the _homeassistant_venv_ back to your `pi` environment.
120+
121+
As all of the following steps should be under the `pi` user environment.
122+
123+
###### Install _RTIMU_
124+
125+
```bash
126+
# Install RTIMU to pi user environment
127+
pip3 install rtimulib
128+
129+
# Add symlink to RTIMU in _homeassistant_venv_
130+
# Create a symlink using the following command:
131+
ln -s /usr/lib/python3/dist-packages/RTIMU.cpython-34m-arm-linux-gnueabihf.so /srv/homeassistant/homeassistant_venv/lib/python3.4/
132+
133+
# Add _homeassistant_ user to the _input_ and the _i2c_ groups
134+
sudo addgroup homeassistant input
135+
sudo addgroup homeassistant i2c
136+
137+
# Reboot Raspberry Pi to apply changes
138+
sudo reboot
139+
```
140+
141+
Unfortunately enabling the SenseHAT Sensor component for a Virtual Environment install of Home-Assistant fails with errors.
142+
_(The Raspberry Pi All-In-One installer and HASSbian both run Home-Assistant in an virtual environment)._
143+
These issues have been discussed in the repository issue (#5093)[https://github.com/home-assistant/home-assistant/issues/5093)
144+
145+
This fix has been tested with a clean install of:
146+
147+
* [Raspbian Jessie - version January 2017](https://downloads.raspberrypi.org/raspbian/images/raspbian-2017-01-10/)
148+
149+
and
150+
151+
* [Home-Assistant 0.37.1](https://home-assistant.io/getting-started/installation-raspberry-pi-all-in-one/)

0 commit comments

Comments
 (0)