From 1a9eb04de1b555855251be1e7e1a674700383326 Mon Sep 17 00:00:00 2001 From: tpollina Date: Fri, 13 Dec 2019 15:00:20 -0800 Subject: [PATCH] Create fan.py --- scripts/fan.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 scripts/fan.py diff --git a/scripts/fan.py b/scripts/fan.py new file mode 100644 index 0000000..ac2728b --- /dev/null +++ b/scripts/fan.py @@ -0,0 +1,23 @@ +#!/usr/bin/python +import smbus +import sys + +state = str(sys.argv[1]) + +bus = smbus.SMBus(1) + +DEVICE_ADDRESS = 0x0d + +def fan(state): + if state == 'off': + bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x00) + bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x00) + if state == 'on': + bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x01) + bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x01) + +fan(state) + + + +