From 62c5dbf2c4e1014910b13860ba4e6fe06f6ffd08 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 19 Sep 2021 02:20:57 +0200 Subject: improved sensors initialization --- .../group_vars/chaos-at-home-sensors/vars.yml | 33 +++++++++++++++------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'inventory/group_vars/chaos-at-home-sensors') diff --git a/inventory/group_vars/chaos-at-home-sensors/vars.yml b/inventory/group_vars/chaos-at-home-sensors/vars.yml index 2eea9b2c..7f4a93eb 100644 --- a/inventory/group_vars/chaos-at-home-sensors/vars.yml +++ b/inventory/group_vars/chaos-at-home-sensors/vars.yml @@ -1,5 +1,20 @@ --- sensornode_network_wired: no +sensornode_sensors: {} + +# TODO: add script to initialize i2c devices +## I2C Bus init examples: +## * add 8ch mux: echo "pca9548 0x70" > /sys/bus/i2c/devices/i2c-0/new_device +## * add DS2482: echo "ds2482 0x18" > /sys/bus/i2c/devices/i2c-0/new_device +## * add ADS1115: echo "ads1115 0x48" > /sys/bus/i2c/devices/i2c-0/new_device +## * add BME280: echo "bme280 0x76" > /sys/bus/i2c/devices/i2c-1/new_device +## * add BMP280: echo "bmp280 0x77" > /sys/bus/i2c/devices/i2c-1/new_device +## * add AM2315: echo "am2315 0x5c" > /sys/bus/i2c/devices/i2c-1/new_device +## * add MCP3221: echo "mcp3221 0x4d" > /sys/bus/i2c/devices/i2c-2/new_device + +# TODO: add collector for prometheus to export i2c-sensor data + + install_playbook: openwrt @@ -59,17 +74,15 @@ openwrt_mixin: /etc/htoprc: file: "{{ global_files_dir }}/common/htoprc" -# TODO: add script to initialize i2c devices -## I2C Bus init examples: -## * add 8ch mux: echo "pca9548 0x70" > /sys/bus/i2c/devices/i2c-0/new_device -## * add DS2482: echo "ds2482 0x18" > /sys/bus/i2c/devices/i2c-0/new_device -## * add ADS1115: echo "ads1115 0x48" > /sys/bus/i2c/devices/i2c-0/new_device -## * add BME280: echo "bme280 0x76" > /sys/bus/i2c/devices/i2c-1/new_device -## * add BMP280: echo "bmp280 0x77" > /sys/bus/i2c/devices/i2c-1/new_device -## * add AM2315: echo "am2315 0x5c" > /sys/bus/i2c/devices/i2c-1/new_device -## * add MCP3221: echo "mcp3221 0x4d" > /sys/bus/i2c/devices/i2c-2/new_device + /etc/sensors.json: + content: "{{ sensornode_sensors | to_nice_json(indent=2) }}\n" -# TODO: add collector for prometheus to export i2c-sensor data + /usr/lib/lua/sensors.lua: + file: "{{ global_files_dir }}/common/openwrt/sensors.module_lua" + + /usr/libexec/sensors-init.lua: + file: "{{ global_files_dir }}/common/openwrt/sensors-init.lua" + mode: "0755" openwrt_uci: -- cgit v1.2.3