Jarvis: Difference between revisions

From NURDspace
No edit summary
 
(40 intermediate revisions by 9 users not shown)
Line 5: Line 5:
|Purpose=Infra
|Purpose=Infra
|Tool=No
|Tool=No
|Location=Erratic
}}
}}
Jarvis is the VM running Home Assistant (HASS) and is able to automate tasks in the space
Jarvis is the VM running Home Assistant ([http://hass.io HASS] ) on [[Coherence]] and is able to automate tasks in the space
See http://10.208.11.32/ or http://10.208.11.32:8123 when port 80 is not working. Port 80 should work because of a port forward started from /etc/rc.local.
 
== Web interface ==
* http://jarvis.vm.nurd.space/ or http://10.208.1.49/ and in case this doesn't work: http://10.208.1.49:8123/
* user: nurds
* pass: same as wifi, ask in the space
 
=== Known issues ===
* Firefox
** required key not provided @ data['redirect_url'] : https://github.com/home-assistant/home-assistant-polymer/issues/2828#issuecomment-467589688
 
== VM access ==
If you want access to the VM itself, for instance with SSH, use following creds:
* User: nurds
* Pass: the long one :)
 
== root access ==
To gain root access to the jarvis vm, you need to attach a blockdevice to the VM with a single ext4 or vfat partition on there with the case-sensitive label "CONFIG". On this filesystem, place a file called "authorized_keys". Next, run "ha os import" from within the walled-garden shell. This will start sshd on port 22222, allowing you access as root to the VM. To disable this access, detach the blockdevice from the system. See the following procedure for more details: https://developers.home-assistant.io/docs/operating-system/debugging/
 
== Starting HASS ==
== Starting HASS ==
<pre>
It starts automatically with Erratic
/etc/init.d/homeassistant install
 
/etc/init.d/homeassistant start
iptables port forward: iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8123
</pre>
It should do this on boot through /etc/rc.local.


== Current Automations ==
== Current Automations ==
Line 22: Line 38:


== Custom stuff ==
== Custom stuff ==
=== Voice Assistant ===
* Reachable via phone on 8888 (in english)
* Using Piper (TTS)
* Using Whisper (STT)
* Connected via Wyoming (https://www.home-assistant.io/blog/2023/04/27/year-of-the-voice-chapter-2/#wyoming-the-voice-assistant-glue)
=== OpenTherm Gateway===
=== OpenTherm Gateway===
OpenTherm gateway has been put between the heater and the thermostat, see [[OpenTherm_Gateway]]
OpenTherm gateway has been put between the heater and the thermostat, see [[OpenTherm_Gateway]]
=== Flukso ===
Runs stuff for power meter, see [[Flukso]].
=== EPC (PDU) ===
=== EPC (PDU) ===
http://wiki.gude.info/FAQ_EPC_CmdLine
Now replaced with epcMqttBridge by [[user:melan]] running on docker.vm.nurd.space.
For source see https://github.com/NURDspace/epcMqttBridge
 
Was previously:
https://gist.github.com/zarya/52b603146faac2b3d42e417532975054
<pre><nowiki>
<pre><nowiki>
root@jarvis:/home/homeassistant/.homeassistant# cat switches.yaml
- platform: command_line
- platform: command_line
   switches:
   switches:
     epc2_1:
     epc2_1:
       command_on: "/usr/bin/curl http://<IP>/SWOV.CGI?s1=1"
       command_on: "/config/epc.py <IP> 1 1"
       command_off: "/usr/bin/curl http://<IP>/SWOV.CGI?s1=0"
       command_off: "/config/epc.py <IP> 1 0"
       command_state: "/opt/epc/epccontrol2.pl --host=<IP> | grep 1"
       command_state: "/config/epc.py <IP> 1"
       value_template: '{{ value == "1 is ON" }}'
       value_template: '{{ value == "ON" }}'
      friendly_name: epc2 1
</nowiki></pre>
</nowiki></pre>
http://wiki.gude.info/FAQ_EPC_CmdLine


=== APC (PDU) ===
=== APC (PDU) ===
Line 46: Line 70:
  output 1 == on 2 == off
  output 1 == on 2 == off
  get input amps (x10) snmpget -v1 -OvqU -c NURDsnmp 10.208.30.150 .1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1
  get input amps (x10) snmpget -v1 -OvqU -c NURDsnmp 10.208.30.150 .1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1
==== Sensor (Amps) ====
==== Sensor (Amps) ====
<pre><nowiki>
<pre><nowiki>
- platform: command_line
- platform: snmp
   name: pdu1_input_amps  
   name: 'pdu1_input_amps'
   command: "snmpget -v1 -OvqU -c public 10.208.30.150 .1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1"
   host: <IP>
   unit_of_measurement: "A"
  community: "this"
   value_template: '{{ value | multiply(10) }}'
  baseoid: .1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1
  version: "1"
  accept_errors: true
   unit_of_measurement: 'A'
   value_template: '{{ value | float / 10 }}'
 
</nowiki></pre>
</nowiki></pre>


==== Switch ====
==== Switch ====
<pre><nowiki>
<pre><nowiki>
    pdu1_1:
- platform: snmp
      command_on: "snmpset -v1 -c private 10.208.30.150 .1.3.6.1.4.1.318.1.1.4.4.2.1.3.1 i 1"
  name: pdu1_1
      command_off: "snmpset -v1 -c private 10.208.30.150 .1.3.6.1.4.1.318.1.1.4.4.2.1.3.1 i 2"
  host: <IP>
      command_state: "snmpget -v1 -OvqU -c public 10.208.30.150 .1.3.6.1.4.1.318.1.1.4.4.2.1.3.1"
  baseoid: .1.3.6.1.4.1.318.1.1.4.4.2.1.3.1
      value_template: '{{ value == "1" }}'
  community: "this"
      friendly_name: pdu1 1
  payload_on: 1
</nowiki></pre>
  payload_off: 2
=== [[SonOff]] ===
  version: "1"
<pre><nowiki>
- platform: snmp
- platform: mqtt
  name: pdu1_1
   name: "Grote zaal rechts"
  host: <IP>
   state_topic: "space/grotezaal/rechts/1/stat"
  baseoid: .1.3.6.1.4.1.318.1.1.4.4.2.1.3.2
   command_topic: "space/grotezaal/rechts/1"
   community: "this"
   qos: 0
   payload_on: 1
  payload_on: "on"
   payload_off: 2
  payload_off: "off"
   version: "1"
  retain: true
 
</nowiki></pre>
</nowiki></pre>
=== Notifications ===
==== LEDtickers ====
You can use services '''notify.ledticker_zaal1''', '''notify.ledticker_bar''' and '''notify.ledticker_rookhok''' to send stuff to individual LEDtickers, or '''notify.all_ledtickers''' to send to all. The custom component for this can be found in ''/usr/share/hassio/homeassistant/custom_components/ledticker''. New LEDtickers can be set up in ''/usr/share/hassio/homeassistant/configuration.yaml''.
Todo:
* Possibility to use host names instead of IPs
==== IRC bot notifications ====
<s>Spams stuff using service '''notify.nurdbot''' @ [[Nurdbot]] using ''/usr/share/hassio/homeassistant/jsb/jsb-udpsend''.</s>
Does this work for [[GHBot]]????
== Device tracker ==
We get MAC addresses that are connected to the Wifi from the Aruba AP. We do not track devices by default.
=== Why would you want to be tracked? ===
We can do reporting of tracked devices and whether they are 'home' or 'not_home'.
One example that we have is !who on [[Nurdbot]].
We might also do personalized automations at some point.
=== Enable tracking for your wifi MAC address ===
If you want your wifidevice to be tracked, you need to search for your wifi MAC address in ''known_devices.yaml'' and add some details:
* Open the file editor http://10.208.1.49/core_configurator
* top left 'folder icon' , click it, search known_devices.yaml in the list, click it
* ctrl-f for your mac address here (DO NOT ADD ENTRIES!!!)
* Set ''track'' to ''true''
* Set ''name'' to something recognizable
* Reload known_devices (Developer Tools -> YAML -> Restart)
* Configure a ''person'' in http://10.208.1.49/config/person with the tracked device(s)


== Changelog ==
== Changelog ==
Line 83: Line 144:
* Added grote zaal rechts (TL)
* Added grote zaal rechts (TL)
* Added Webcam connected to [[SlabPi]]
* Added Webcam connected to [[SlabPi]]
* Moved to hass.io
* Moved SonOff Basic to ESPHome and MQTT discovery
* Added octoprint
* Enabled device tracking through Aruba AP


== New jarvis ==
== Installation ==
We want to be able to easily update home assistant. One way to achieve this is to use docker. On our proxmox environment it is not easy to run docker in a proxmox container, so we set up a prober VM for this.
We want to be able to easily update home assistant. One way to achieve this is to use Hass.io which in turn uses docker. On our proxmox environment it is not easy to run docker in a proxmox container, so we set up a proper VM for this.
 
The idea is to get the config from the old jarvis working and at some point have the new one take the IP address of the old one. For now the new one is configged with DHCP.
 
* Temp IP: 10.208.42.142
* User: nurds
* Pass: the long one :)


=== Docker installation ===
=== Docker installation ===
Line 100: Line 159:
https://www.home-assistant.io/blog/2017/11/29/hassio-virtual-machine/
https://www.home-assistant.io/blog/2017/11/29/hassio-virtual-machine/
Using the install script https://raw.githubusercontent.com/home-assistant/hassio-build/master/install/hassio_install
Using the install script https://raw.githubusercontent.com/home-assistant/hassio-build/master/install/hassio_install
== Actions done ==
* Add all mqtt sensors
* Add all other config that works out of the box


== Actions open ==
=== Logging MQTT addon turned off ===
* Migrate nurdbot notifier
Because mosquitto was filling the disks with logs a .conf file was put in /usr/share/hassio/share/mosquitto with following contents:
* Migrate APC power bar scripts
** on/off
** Amp meter
* Migrate noname power bar scripts


== Web interface ==
<pre>
* user: nurds
log_dest none
* pass: same as wifi ask in the space
</pre>


After a restart of the addon, logging only shows startup until the added config file is read.


===To Do===
==To Do==
[[Radiator automation]] integration.
[[Radiator automation]] integration.

Latest revision as of 21:53, 11 March 2024

Jarvis
Jarvis.jpg
Participants Dennis
Skills Electronics, IoT
Status Production
Niche
Purpose Infra
Tool No
Location Erratic
Cost
Tool category

Jarvis Property "Tool Image" (as page type) with input value "File:{{{Picture}}}" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process. {{{Picture}}} {{#if:No | [[Tool Owner::{{{ProjectParticipants}}} | }} {{#if:No | [[Tool Cost::{{{Cost}}} | }}

Jarvis is the VM running Home Assistant (HASS ) on Coherence and is able to automate tasks in the space

Web interface

Known issues

VM access

If you want access to the VM itself, for instance with SSH, use following creds:

  • User: nurds
  • Pass: the long one :)

root access

To gain root access to the jarvis vm, you need to attach a blockdevice to the VM with a single ext4 or vfat partition on there with the case-sensitive label "CONFIG". On this filesystem, place a file called "authorized_keys". Next, run "ha os import" from within the walled-garden shell. This will start sshd on port 22222, allowing you access as root to the VM. To disable this access, detach the blockdevice from the system. See the following procedure for more details: https://developers.home-assistant.io/docs/operating-system/debugging/

Starting HASS

It starts automatically with Erratic

iptables port forward: iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8123

Current Automations

  • Stop music on mpd when the space is closed
  • Start music on mpd when the space opens.
  • Power down EPC/APC and Sonoff when space is closed.
  • Power up Sonoff when space is open.

Custom stuff

Voice Assistant

OpenTherm Gateway

OpenTherm gateway has been put between the heater and the thermostat, see OpenTherm_Gateway

EPC (PDU)

Now replaced with epcMqttBridge by user:melan running on docker.vm.nurd.space. For source see https://github.com/NURDspace/epcMqttBridge

Was previously: https://gist.github.com/zarya/52b603146faac2b3d42e417532975054

- platform: command_line
  switches:
    epc2_1:
      command_on: "/config/epc.py <IP> 1 1"
      command_off: "/config/epc.py <IP> 1 0"
      command_state: "/config/epc.py <IP> 1"
      value_template: '{{ value == "ON" }}'

http://wiki.gude.info/FAQ_EPC_CmdLine

APC (PDU)

Off snmpset -v1 -c private 10.208.30.150 .1.3.6.1.4.1.318.1.1.4.4.2.1.3.1 i 2 
On snmpset -v1 -c private 10.208.30.150 .1.3.6.1.4.1.318.1.1.4.4.2.1.3.1 i 1
get snmpget -v1 -OvqU -c public 10.208.30.150 .1.3.6.1.4.1.318.1.1.4.4.2.1.3.1
output 1 == on 2 == off
get input amps (x10) snmpget -v1 -OvqU -c NURDsnmp 10.208.30.150 .1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1

Sensor (Amps)

- platform: snmp
  name: 'pdu1_input_amps'
  host: <IP>
  community: "this"
  baseoid: .1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1
  version: "1"
  accept_errors: true
  unit_of_measurement: 'A'
  value_template: '{{ value | float / 10 }}'

Switch

- platform: snmp
  name: pdu1_1
  host: <IP>
  baseoid: .1.3.6.1.4.1.318.1.1.4.4.2.1.3.1
  community: "this"
  payload_on: 1
  payload_off: 2
  version: "1"
- platform: snmp
  name: pdu1_1
  host: <IP>
  baseoid: .1.3.6.1.4.1.318.1.1.4.4.2.1.3.2
  community: "this"
  payload_on: 1
  payload_off: 2
  version: "1"

Notifications

LEDtickers

You can use services notify.ledticker_zaal1, notify.ledticker_bar and notify.ledticker_rookhok to send stuff to individual LEDtickers, or notify.all_ledtickers to send to all. The custom component for this can be found in /usr/share/hassio/homeassistant/custom_components/ledticker. New LEDtickers can be set up in /usr/share/hassio/homeassistant/configuration.yaml.

Todo:

  • Possibility to use host names instead of IPs

IRC bot notifications

Spams stuff using service notify.nurdbot @ Nurdbot using /usr/share/hassio/homeassistant/jsb/jsb-udpsend.

Does this work for GHBot????

Device tracker

We get MAC addresses that are connected to the Wifi from the Aruba AP. We do not track devices by default.

Why would you want to be tracked?

We can do reporting of tracked devices and whether they are 'home' or 'not_home'. One example that we have is !who on Nurdbot. We might also do personalized automations at some point.

Enable tracking for your wifi MAC address

If you want your wifidevice to be tracked, you need to search for your wifi MAC address in known_devices.yaml and add some details:

  • Open the file editor http://10.208.1.49/core_configurator
  • top left 'folder icon' , click it, search known_devices.yaml in the list, click it
  • ctrl-f for your mac address here (DO NOT ADD ENTRIES!!!)
  • Set track to true
  • Set name to something recognizable
  • Reload known_devices (Developer Tools -> YAML -> Restart)
  • Configure a person in http://10.208.1.49/config/person with the tracked device(s)

Changelog

  • Added the EPC PDU's to HASS
  • Added the space state
  • Added power usage
  • Added Axis camera
  • Added grote zaal rechts (TL)
  • Added Webcam connected to SlabPi
  • Moved to hass.io
  • Moved SonOff Basic to ESPHome and MQTT discovery
  • Added octoprint
  • Enabled device tracking through Aruba AP

Installation

We want to be able to easily update home assistant. One way to achieve this is to use Hass.io which in turn uses docker. On our proxmox environment it is not easy to run docker in a proxmox container, so we set up a proper VM for this.

Docker installation

Home assistant config location: /usr/share/hassio/homeassistant# Enabled docker repo and installed it (https://docs.docker.com/install/linux/docker-ce/ubuntu/). User nurds is in the docker group so it can do docker things without sudo.

Installed HASS.IO x86 https://www.home-assistant.io/blog/2017/11/29/hassio-virtual-machine/ Using the install script https://raw.githubusercontent.com/home-assistant/hassio-build/master/install/hassio_install

Logging MQTT addon turned off

Because mosquitto was filling the disks with logs a .conf file was put in /usr/share/hassio/share/mosquitto with following contents:

log_dest none

After a restart of the addon, logging only shows startup until the added config file is read.

To Do

Radiator automation integration.