From 66b38ceaacb3951fb0fd55f3da963bea6bcb4dff Mon Sep 17 00:00:00 2001 From: "George.M" Date: Sat, 11 Feb 2017 19:51:36 +0000 Subject: [PATCH 1/2] Update to components/sensor.sensehat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Have provided more information on how to install the SenseHAT for Virtual Environment installs • Have included directions on making the SenseHAT prettier --- source/_components/sensor.sensehat.markdown | 108 ++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/source/_components/sensor.sensehat.markdown b/source/_components/sensor.sensehat.markdown index b4c1b377ca87..66ac0211962b 100644 --- a/source/_components/sensor.sensehat.markdown +++ b/source/_components/sensor.sensehat.markdown @@ -35,4 +35,112 @@ Configuration variables: - 'humidity' - 'pressure' +___ +#### Customizing the Sense HAT data + +**Format the sensor values** +Add the following to your `sensors.yaml` + +``` +- 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: '%' +``` + +**Give the values friendly names & icons** +Add the following to your `customize.yaml` + +``` +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" +``` + +**Create a group** +Add the following to your `groups.yaml` + +``` +sense_hat: + name: Sense HAT + entities: + - sensor.sensehat_temperature + - sensor.sensehat_humidity + - sensor.sensehat_pressure + +``` +Add the _sense hat_ group to your group with: +``` + - group.sense_hat +``` +___ + +### 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 enviroment versions. + +#### Install SenseHAT package to _homeassistant_venv_ +`sudo su -s /bin/bash homeassistant` + +`source /srv/homeassistant/homeassistant_venv/bin/activate` + +`pip3 install sense-hat` + +(be patient, this will take a long while) + +#### 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. + +###### Install _RTIMU_ + +`pip3 install rtimulib` + +###### Add symlink to RTIMU in _homeassistant_venv_ +Create a symlink using the following command: + +`ln -s /usr/lib/python3/dist-packages/RTIMU.cpython-34m-arm-linux-gnueabihf.so /srv/homeassistant/homeassistant_venv/lib/python3.4/` + +###### Add _homeassistant_ user to the _input_ and the _i2c_ groups +`sudo addgroup homeassistant input` + +`sudo addgroup homeassistant i2c` + +###### Reboot Raspberry Pi to apply changes +`sudo reboot` + +:100: + +___ + +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)[https://github.com/home-assistant/home-assistant/issues/5093) + +This fix has been tested with a clean install of: + +* [Raspbian Jessie - version January 2017](https://downloads.raspberrypi.org/raspbian/images/raspbian-2017-01-10/) + +and + +* [Home-Assistant 0.37.1](https://home-assistant.io/getting-started/installation-raspberry-pi-all-in-one/) From d6df648e41ae823965eee74454961fb53437a08a Mon Sep 17 00:00:00 2001 From: "George.M" Date: Sun, 12 Feb 2017 00:23:54 +0000 Subject: [PATCH 2/2] Amends to comform with PR --- source/_components/sensor.sensehat.markdown | 137 ++++++++++---------- 1 file changed, 71 insertions(+), 66 deletions(-) diff --git a/source/_components/sensor.sensehat.markdown b/source/_components/sensor.sensehat.markdown index 66ac0211962b..468e1a4eef56 100644 --- a/source/_components/sensor.sensehat.markdown +++ b/source/_components/sensor.sensehat.markdown @@ -35,78 +35,86 @@ Configuration variables: - 'humidity' - 'pressure' -___ #### Customizing the Sense HAT data **Format the sensor values** -Add the following to your `sensors.yaml` +Add the following to your `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: '%' +```yaml +# Example configuration.yaml entry +sensor: + - platform: sensehat + display_options: + - temperature + - humidity + - pressure + + - platform: template + sensors: + sensehat_temperature: + value_template: '{% raw %}{{ states.sensor.temperature.state | round(1) }}{% endraw %}' + unit_of_measurement: '°C' + sensehat_pressure: + value_template: '{% raw %}{{ states.sensor.pressure.state | round(1) }}{% endraw %}' + unit_of_measurement: 'mb' + sensehat_humidity: + value_template: '{% raw %}{{ states.sensor.humidity.state | round(1) }}{% endraw %}' + unit_of_measurement: '%' ``` **Give the values friendly names & icons** -Add the following to your `customize.yaml` +Add the following to your `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" +```yaml +# 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" ``` **Create a group** -Add the following to your `groups.yaml` - -``` -sense_hat: - name: Sense HAT - entities: - - sensor.sensehat_temperature - - sensor.sensehat_humidity - - sensor.sensehat_pressure +Add the following to your `groups` +```yaml +# 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 to your group with: -``` +Add the _sense_hat group_ a group (_Kitchen for example_) +```yaml +# Example configuration.yaml entry +group: + kitchen: - group.sense_hat ``` -___ + ### 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 enviroment versions. #### Install SenseHAT package to _homeassistant_venv_ -`sudo su -s /bin/bash homeassistant` - -`source /srv/homeassistant/homeassistant_venv/bin/activate` - -`pip3 install sense-hat` - -(be patient, this will take a long while) - +```bash +# switch to the homeassistant_venv environment +sudo su -s /bin/bash homeassistant +source /srv/homeassistant/homeassistant_venv/bin/activate + +# install the sense-hat lib +pip3 install sense-hat +# be patient, this will take a long while +``` #### Return to `pi` Type `exit` to quit out of the _homeassistant_venv_ back to your `pi` environment. @@ -114,24 +122,21 @@ As all of the following steps should be under the `pi` user environment. ###### Install _RTIMU_ -`pip3 install rtimulib` - -###### Add symlink to RTIMU in _homeassistant_venv_ -Create a symlink using the following command: - -`ln -s /usr/lib/python3/dist-packages/RTIMU.cpython-34m-arm-linux-gnueabihf.so /srv/homeassistant/homeassistant_venv/lib/python3.4/` +```bash +# Install RTIMU to pi user environment +pip3 install rtimulib -###### Add _homeassistant_ user to the _input_ and the _i2c_ groups -`sudo addgroup homeassistant input` +# Add symlink to RTIMU in _homeassistant_venv_ +# Create a symlink using the following command: +ln -s /usr/lib/python3/dist-packages/RTIMU.cpython-34m-arm-linux-gnueabihf.so /srv/homeassistant/homeassistant_venv/lib/python3.4/ -`sudo addgroup homeassistant i2c` +# Add _homeassistant_ user to the _input_ and the _i2c_ groups +sudo addgroup homeassistant input +sudo addgroup homeassistant i2c -###### Reboot Raspberry Pi to apply changes -`sudo reboot` - -:100: - -___ +# 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)._