Skip to content

Commit

Permalink
Use bashio::info instead of direct supervisor api calls (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
mib1185 authored Jan 7, 2024
1 parent 0fb1bc4 commit 3acea60
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion snmpd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apt-get update \
&& apt-get clean autoclean \
&& apt-get autoremove -y

COPY read_supervisor_data.sh /
COPY bashio_info.sh /
COPY run.sh /

CMD ["/run.sh"]
3 changes: 3 additions & 0 deletions snmpd/bashio_info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
"bashio::info.${1}"
6 changes: 0 additions & 6 deletions snmpd/read_supervisor_data.sh

This file was deleted.

18 changes: 9 additions & 9 deletions snmpd/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ NAME=$(bashio::config 'snmp_name')
LOCATION=$(bashio::config 'snmp_location')
CONTACT=$(bashio::config 'snmp_contact')

HAOS_HOSTNAME=$(/read_supervisor_data.sh hostname)
HAOS_MACHINE=$(/read_supervisor_data.sh machine)
HAOS_OPERATING_SYSTEM=$(/read_supervisor_data.sh operating_system)
HAOS_HOSTNAME=$(bashio::info.hostname)
HAOS_MACHINE=$(bashio::info.machine)
HAOS_OPERATING_SYSTEM=$(bashio::info.operating_system)

UN_KERNEL_NAME=$(uname -s)
UN_KERNEL_RELEASE=$(uname -r)
Expand All @@ -32,12 +32,12 @@ view all included .1 80
access MyROGroup "" any noauth exact all none none
# hass data
extend hass_docker_version '/read_supervisor_data.sh docker'
extend hass_hassos_version '/read_supervisor_data.sh hassos'
extend hass_homeassistant_version '/read_supervisor_data.sh homeassistant'
extend hass_supervisor_version '/read_supervisor_data.sh supervisor'
extend hass_state '/read_supervisor_data.sh state'
extend hass_supported '/read_supervisor_data.sh supported'
extend hass_docker_version '/usr/bin/bashio /bashio_info.sh docker'
extend hass_hassos_version '/usr/bin/bashio /bashio_info.sh hassos'
extend hass_homeassistant_version '/usr/bin/bashio /bashio_info.sh homeassistant'
extend hass_supervisor_version '/usr/bin/bashio /bashio_info.sh supervisor'
extend hass_state '/usr/bin/bashio /bashio_info.sh state'
extend hass_supported '/usr/bin/bashio /bashio_info.sh supported'
#libreNMS distro detection
extend distro '/bin/echo $HAOS_OPERATING_SYSTEM'
Expand Down

0 comments on commit 3acea60

Please sign in to comment.