Continuation from Part II

Configuration

Edit Home Assistant configuration file in /home/homeassistant/.homeassistant/configuration.yaml.

To use the GPIO Pins:

  • binary_sensor:
      platform: rpi_gpio
      ports:
            04: Front Doors
        17: Back Doors
        24: Master Bed Windows
      pull_mode: UP
      invert_logic: true
      bouncetime : 1

To enable pushBullet notifications for changes of the GPIO Pins (repeat for each pin):

  • automation:
       alias: GPIO Contact 1 On
       id: '1498531284301'
      
    trigger:
         platform: state
         entity_id: binary_sensor.front_doors
         from: 'off'
         to: 'on'
       action:
         service: notify.pushbullet
         data:
           title: "Zone 1 Open"
           M
    essage: "Front Doors"

To support devices from a SmartThings hub, add the following:

  • Dimmable light:
       platform: mqtt
       name: "Light"
       state_topic: "smartthings/Light/switch"
       command_topic: "smartthings/Light/switch"
       brightness_state_topic: "smartthings/Light/level"
       brightness_command_topic: "smartthings/Light/level"
       brightness_scale: 100
       payload_on: "on"
       payload_off: "off"
       optimistic: false
       retain: true

  • Light switch:
       platform: mqtt
       name: "Light"
       state_topic: "smartthings/Light/switch"
       command_topic: "smartthings/Light/switch"
       payload_on: "on"
       payload_off: "off"
       optimistic: false
       retain: true

  • Fan:
       platform: mqtt
       name: "Fan"
       state_topic: "smartthings/Fan/switch"
       command_topic: "smartthings/Fan/switch"
       speed_state_topic: "smartthings/Fan/level"
       speed_command_topic: "smartthings/Fan/level"
       payload_on: "on"
       payload_off: "off"
       payload_low_speed: "33"
       payload_medium_speed: "66"
       payload_high_speed: "99"
       speeds:
         low
         medium
         high
       optimistic: false
       retain: true

Conclusion

The Raspberry Pi hosted Home Assistant worked as expected after a few modifications. During initial testing, I found that the PiFace interface caused number of problems, ranging from excessive memory usage and timeout errors. Once the Raspberry Pi's GPIO pins were used instead of the PiFace and dtparam=spi=off,the CPU Usage generally hovered around 10% with minimal timeout errors.

There did seem to be one last minor issue, either related to the poor performance of the Raspberry Pi chosen for the prototype or due to a design flaw in Home Assistant. The problem arose when a high communications load was placed on the  Raspberry Pi either through the sensor platform: speedtest, or through the sensor platform: yr, which retrieves the weather forecast from the Norwegian Meteorological Institute and the NRK. The temporary solution was to simply disable the weather forecast and to only to use speedtest once per day.