ups monitor

ups status monitor for Raspberry Pi Openwrt

图片 connect (openwrt raspbeery pi需要先安装i2c内核驱动的支持)
Raspberry Pi I2C interface
hack (如果获取ups连接到树莓派后,用的是哪个地址)
opkg install  i2c-tools

i2cdetect -y 1

默认设置的地址为 0x42(需要修改 /ina219.go#L44)

	// create the sensor Opts
	sensorOpts := ina219.Opts{
		Address:       0x42, // ina219 ic2 address
		SenseResistor: 100 * physic.MilliOhm,     // 0.1Ohm
		MaxCurrent:    1000 * physic.MilliAmpere, //1A
	}
depend how to build

Install golang in the host (the host system must by Linux or Mac)

just run make to build the ups_monitor

make
Install ups_monitor to Raspbery Pi

192.168.xx.xx is the ip of you RPI

scp ups_monitor root@192.168.xx.xx:/tmp
Run ups_monitor on Raspberry Pi

connect RPI with ssh

cd /tmp
mv /tmp/ups_monitor /usr/bin/ups_monitor
ups_monitor
wiki

ups-hat介绍文档

Raspberry Pi OpenWRT打开 I2C支持

python support from waveshare 声明

此代码,目前只测试于 微雪的UPS_HAT

编译的时候,需要go支持