Some teething issues in general

227 views
Skip to first unread message

Jon Andrews

unread,
Oct 29, 2015, 7:19:44 AM10/29/15
to Home Assistant Dev
Hi all

Firstly, loving HASS, looks great and really is the first multi platform interafecee Ive seen that works as well on a desktop as on a phone/tablet.

Being a total noob to the Pi and also Rasbian too, it was a hard slog at the start and ive still not managed to get the system to automatically start in the background yet.

This is the service script that I placed in /etc/init.d


#!/bin/sh
### BEGIN INIT INFO
# Provides:          hass
# Required-Start:    $local_fs $network $named $time $syslog
# Required-Stop:     $local_fs $network $named $time $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Description:       Home\ Assistant
### END INIT INFO

# /etc/init.d Service Script for Home Assistant
# Created with: https://gist.github.com/naholyr/4275302#file-new-service-sh
#
# Installation:
#   1) If any commands need to run before executing hass (like loading a
#      virutal environment), put them in PRE_EXEC. This command must end with
#      a semicolon.
#   2) Set RUN_AS to the username that should be used to execute hass.
#   3) Copy this script to /etc/init.d/
#       sudo cp hass-daemon /etc/init.d/hass-daemon
#       sudo chmod +x /etc/init.d/hass-daemon
#   4) Register the daemon with Linux
#       sudo update-rc.d hass-daemon defaults
#   5) Install this service
#       sudo service hass-daemon install
#   6) Restart Machine
#
# After installation, HA should start automatically. If HA does not start,
# check the log file output for errors.
#       /var/opt/homeassistant/home-assistant.log

PRE_EXEC=""
RUN_AS="pi"
PID_FILE="/var/run/hass.pid"
CONFIG_DIR="/var/opt/homeassistant"
FLAGS="-v --config $CONFIG_DIR --pid-file $PID_FILE --daemon"
REDIRECT="> $CONFIG_DIR/home-assistant.log 2>&1"

start() {
  if [ -f $PID_FILE ] && kill -0 $(cat $PID_FILE) 2> /dev/null; then
    echo 'Service already running' >&2
    return 1
  fi
  echo 'Starting service…' >&2
  local CMD="$PRE_EXEC hass $FLAGS $REDIRECT;"
  su -c "$CMD" $RUN_AS
  echo 'Service started' >&2
}

stop() {
    if [ ! -f "$PID_FILE" ] || ! kill -0 $(cat "$PID_FILE") 2> /dev/null; then
    echo 'Service not running' >&2
    return 1
  fi
  echo 'Stopping service…' >&2
  kill -3 $(cat "$PID_FILE")
  while ps -p $(cat "$PID_FILE") > /dev/null 2>&1; do sleep 1;done;
  echo 'Service stopped' >&2
}

install() {
    echo "Installing Home Assistant Daemon (hass-daemon)"
    echo "999999" > $PID_FILE
    chown $RUN_AS $PID_FILE
    mkdir -p $CONFIG_DIR
    chown $RUN_AS $CONFIG_DIR
}

uninstall() {
  echo -n "Are you really sure you want to uninstall this service? That cannot be undone. [yes|No] "
  local SURE
  read SURE
  if [ "$SURE" = "yes" ]; then
    stop
    rm -fv "$PID_FILE"
    echo "Notice: The config directory has not been removed"
    echo $CONFIG_DIR
    update-rc.d -f hass-daemon remove
    rm -fv "$0"
    echo "Home Assistant Daemon has been removed. Home Assistant is still installed."
  fi
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  install)
    install
    ;;
  uninstall)
    uninstall
    ;;
  restart)
    stop
    start
    ;;
  *)
    echo "Usage: $0 {start|stop|restart|install|uninstall}"
esac


When I look at the log it shows the following...

Fatal Error: Unable to write pid file /var/run/hass.pid

and if I look in the VAR directory there is no run directory so it makes sense that its unable to write into a directory that doesn't exist an its also not creating one in the process either...I can only sassume that without this file there is no way the service can run correctly.

Any assistance witth this would be great.

Other than this, everything is looking great so far....

Ive added in two NEST Thermostats that I have control of from the webpage, a total of 10 Sonos speaker zones, three Kodi media players and a couple of Wemo Switches















AS you can see I've managed to group all speakers together, and Ive also grouped together most of my instances of Kodi as well but I'm definitely seeing some weird things

Firstly, a switch has appeared on the Movies&TV group....it doesn't seem to do anything but I didn't ask for it to be there, and I didn't even know there was an option to do so....any idea where that has come from and how I turn it off.

Obviously Ive got discovery turned on, and plex has created a plex.conf file so I know its seeing the plex server...but it wont show up on the main screen as a media player....

the plex entry in yaml file is as follows

media_player:
  platform: plex

But nothing is in showing on the GUI

Finally...sorry for this.....at the top where the sunet/sunrise indicator is, oit normally shows mulitple icons,.....usually its just mine and wife's phones, all others are set to NOT show...but for some reason these icons aren't showing at all anymore...nothing has been changed, they just stopped showing.....not the end of the world as the presence doesn't work well with iphones anyway, but its just confusing why they aren't showing anymore









Message has been deleted

Jon Andrews

unread,
Oct 29, 2015, 8:46:18 AM10/29/15
to Home Assistant Dev
strangely PLex just appeared on my GUI and then asked to be configured with the token,  added that in (which has updated the plex.conf file) but now the plex option on GUI has disappeared again.

Also, im sure Im getting ahead of myself here, but is there any way to change which order the groups and buttons appear in...not a problem at all on a desktop/laptop, but on a tablet and even moreso a phone it would be nice to have the camera feeds at the top of the screen

Should say as well that the camera feeds are better using HASS than using the dedicated app they come with, much faster to respond and view

Ive also noticed that not only do the badges for mine and my wifes phone no longer appear in the GUI, but the badges for SABNZBD also no longer show.

sensor:
    platform: sabnzbd
    name: SAB
    api_key: (API key removed)
   
    base_url: (url removed)
    monitored_variables:
        - type: 'current_status'
        - type: 'speed'
        - type: 'queue_size'
        - type: 'queue_remaining'


Thanks in advance

pluggedbean

unread,
Mar 17, 2016, 4:04:42 AM3/17/16
to Home Assistant Dev
Hi Jon
did you ever come right with plex ? I am having the same issue , Plex loads on the gui but I cant do anything with it ( idle control ) . I noticed that when I call the service from dev tools I get the following error in log.

NotImplementedError    raise NotImplementedError()  File "c:\users\pluggedbean.win10\appdata\local\programs\python\python35\lib\site-packages\homeassistant\components\media_player\__init__.py", line 433, in turn_on    getattr(player, method)()  File "c:\users\pluggedbean.win10\appdata\local\programs\python\python35\lib\site-packages\homeassistant\components\media_player\__init__.py", line 237, in media_player_service_handler    self.func(call)  File "c:\users\pluggedbean.win10\appdata\local\programs\python\python35\lib\site-packages\homeassistant\core.py", line 514, in __call__    service(call)  File "c:\users\pluggedbean.win10\appdata\local\programs\python\python35\lib\site-packages\homeassistant\core.py", line 648, in _execute_service    func(arg)  File "c:\users\pluggedbean.win10\appdata\local\programs\python\python35\lib\site-packages\homeassistant\core.py", line 794, in job_handlerTraceback (most recent call last):16-03-17 10:00:42 homeassistant.core: BusHandler:Exception doing jobplexapi.exceptions.BadRequest: (500) internal_server_error    raise BadRequest('(%s) %s' % (response.status_code, codename))  File "C:\Users\Pluggedbean.Win10\AppData\Roaming\.homeassistant\lib\plexapi\server.py", line 91, in query    self.server.query(path)  File "C:\Users\Pluggedbean.Win10\AppData\Roaming\.homeassistant\lib\plexapi\client.py", line 56, in sendServerCommand    return self.sendServerCommand(command, args)  File "C:\Users\Pluggedbean.Win10\AppData\Roaming\.homeassistant\lib\plexapi\client.py", line 42, in sendCommand    def play(self): self.sendCommand('playback/play')  # noqa  File "C:\Users\Pluggedbean.Win10\AppData\Roaming\.homeassistant\lib\plexapi\client.py", line 76, in play    self.device.play()  File "c:\users\pluggedbean.win10\appdata\local\programs\python\python35\lib\site-packages\homeassistant\components\media_player\plex.py", line 305, in media_play    self.media_play()  File "c:\users\pluggedbean.win10\appdata\local\programs\python\python35\lib\site-packages\homeassistant\components\media_player\__init__.py", line 529, in media_play_pause    getattr(player, method)()  File "c:\users\pluggedbean.win10\appdata\local\programs\python\python35\lib\site-packages\homeassistant\components\media_player\__init__.py", line 237, in media_player_service_handler    self.func(call)  File "c:\users\pluggedbean.win10\appdata\local\programs\python\python35\lib\site-packages\homeassistant\core.py", line 514, in __call__    service(call)  File "c:\users\pluggedbean.win10\appdata\local\programs\python\python35\lib\site-packages\homeassistant\core.py", line 648, in _execute_service    func(arg)  File "c:\users\pluggedbean.win10\appdata\local\programs\python\python35\lib\site-packages\homeassistant\core.py", line 794, in job_handlerTraceback (most recent call last):16-03-17 10:00:26 homeassistant.core: BusHandler:Exception doing job16-03-17 09:30:12 homeassistant.components.recorder: Found unfinished sessions
Reply all
Reply to author
Forward
0 new messages