Jump to content

Home Assistant Overlaid Over EISY


Recommended Posts

19 hours ago, Michel Kohanim said:

@carealtor,

It's possible but I am not sure how to deal with support as we are (nor do we have resources) to address HA installation/configuration issues. 

Also, considering the cost of NVMe to be at least $74, it would make the cost of eisy astronomical. 

But if there's enough demand, we'll definitely consider.

With kind regards,
Michel

A different way to offer it is eISY with the NVMe preinstalled & configured. I know it would cost more, more than the parts separately, but I would have bought that way. From the forum it's clear that people are installing it. 

Then it would be on me to run the script, if I wanted HA

  • Like 2
Link to comment
  • 3 weeks later...

@Michel Kohanim

I was looking at options to access HA while it's running in the VM.  Currently only way is to setup VNC to access the VM which isn't very command line friendly so I looked into some other options and came up with two of them.  They can be done manually once HA is installed but I thought it'd be nice to integrate turning them on into the installation process so every one can have access by default.

The first method setups up the VM to offer a console on a virtual serial port.  This works well with the FreeBSD vm command as it will allow you to access the VM from the command line just running "sudo vm console homeassistant" (exit by hitting enter followed by "~~.").  This can be configured without needing to add anything to the eisy so is an easy win.

The second method sets up the VM to listen via SSH on port 22222 and creates a ssh key pair for that access.  This one is a bit more intrusive as it needs to install a few packages to be able to write to the linux ext4 partitions, but overall it's not too bad.

I wrote up the commands needed for each, the idea is to mount the VM partitions locally and make the tweaks needed to the configs before the VM even starts.  I'd suggest you insert them into create_ha_vm.sh script after the coping image step but before the VM starts.

 

#!/bin/sh

####
#
#  Confiugure Home Assistant VM to listen on local console and SSH
#
####

HA_VM_NAME="homeassistant"
VMFILESET="storage/vms"

## Initial setup
TMPDIR=`mktemp -d`
# set zvol to full so partitions are visable
zfs set volmode=full ${VMFILESET}/${HA_VM_NAME}/disk0
sleep 2

## Local Console Access
# mount vm boot dir locally
mount -t msdosfs /dev/zvol/${VMFILESET}/${HA_VM_NAME}/disk0p1 ${TMPDIR}
# add serial console to linux boot command line
sed -i '' -e 's/$/ console=ttyS0,115200/' ${TMPDIR}/cmdline.txt
# umount device
umount ${TMPDIR}
echo "You can access the HA VM by running \"sudo vm console homeassistant\" and logging is as root.  Use \"~~.\" to exit."

## SSH Access
# install ext4 fuse driver and load it
pkg install -y fusefs-lkl
kldload fusefs
# mount vms /root/.ssh directory
lklfuse -o type=ext4 /dev/zvol/${VMFILESET}/${HA_VM_NAME}/disk0p7 ${TMPDIR}
mkdir -p ${TMPDIR}/root/.ssh
chmod 700 ${TMPDIR}/root
chmod 755 ${TMPDIR}/root/.ssh
# create a new SSH keypair and at it as an authorized key in the VM
ssh-keygen -t ed25519 -N "" -C "Access Home Assistant running on eisy on port 22222" -f /home/admin/ha-ssh-key
cp /home/admin/ha-ssh-key.pub ${TMPDIR}/root/.ssh/authorized_keys
# set perms so admin user can access the ssh keys
chown admin:admin /home/admin/ha-ssh-key*
umount ${TMPDIR}
echo "You may also access via SSH using \"ssh -p22222 -i ha-ssh-key root@{HA VM IP}\""

## Clean up
# switch zvol mode back to normal
zfs set volmode=dev ${VMFILESET}/${HA_VM_NAME}/disk0
rmdir ${TMPDIR}

 

For anyone that'd like to do this.  You can either insert it into the appropriate place in create_ha_vm.sh yourself or if you already have a VM you can shut it down, save the above as a script, and run it with sudo.

I tested it from scratch and had success but use at your own risk.

Link to comment

Hello everyone,

@xKing helped us figure out the issue. It's in our networking services which switches between ethernet and wifi. For some reason, when the vm starts, re0 goes up, down, and up and it causes this routine to try and fix it. Anyway, please install the latest udx from staging:

sudo udxops.sh repo.util

sudo pkg install -f udx

NOTE:

To fix this issue, we disable the networking services when vm_enable is in rc.conf. This means that you will NOT be able to use eisy with wifi.

With kind regards,
Michel

Link to comment
Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.2k
×
×
  • Create New...