install smbus2 and properly start scripts with python3
This commit is contained in:
parent
71177bc355
commit
b51347e5ee
|
@ -414,7 +414,8 @@ Raspberry Pi Details:
|
|||
|
||||
You will also need to install some python modules:
|
||||
```sh
|
||||
sudo apt install python3-smbus i2c-tools
|
||||
sudo apt install i2c-tools
|
||||
sudo pip3 install smbus2
|
||||
```
|
||||
|
||||
More information can be found on Yahboom website, on the page [Installing RGB Cooling HAT](https://www.yahboom.net/study/RGB_Cooling_HAT).
|
||||
|
|
|
@ -1413,7 +1413,7 @@
|
|||
"type": "python3-function",
|
||||
"z": "1371dec5.76e671",
|
||||
"name": "fan control",
|
||||
"func": "#!/usr/bin/python\nimport smbus2 as smbus\n\nstate = msg[\"payload\"]\n\nbus = smbus.SMBus(1)\n\nDEVICE_ADDRESS = 0x0d\n\ntry:\n # command happens twice, for reasons\n if state == \"off\":\n bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x00)\n bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x00)\n if state == \"on\":\n bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x01)\n bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x01)\nexcept:\n pass",
|
||||
"func": "#!/usr/bin/python3\nimport smbus2 as smbus\n\nstate = msg[\"payload\"]\n\nbus = smbus.SMBus(1)\n\nDEVICE_ADDRESS = 0x0d\n\ntry:\n # command happens twice, for reasons\n if state == \"off\":\n bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x00)\n bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x00)\n if state == \"on\":\n bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x01)\n bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x01)\nexcept:\n pass",
|
||||
"outputs": 1,
|
||||
"x": 1110,
|
||||
"y": 40,
|
||||
|
@ -6013,7 +6013,7 @@
|
|||
"type": "python3-function",
|
||||
"z": "9daf9e2b.019fc",
|
||||
"name": "action",
|
||||
"func": "#!/usr/bin/python\nimport smbus2 as smbus\n\nbus = smbus.SMBus(1)\n#turn off LED\nbus.write_byte_data(0x0d, 0x07, 0x00)\n#turn off Fan\nbus.write_byte_data(0x0d, 0x08, 0x00)\n\n#msg[\"payload\"] = str(msg[\"topic\"])+' now'\nreturn msg",
|
||||
"func": "#!/usr/bin/python3\nimport smbus2 as smbus\n\nbus = smbus.SMBus(1)\n#turn off LED\nbus.write_byte_data(0x0d, 0x07, 0x00)\n#turn off Fan\nbus.write_byte_data(0x0d, 0x08, 0x00)\n\n#msg[\"payload\"] = str(msg[\"topic\"])+' now'\nreturn msg",
|
||||
"outputs": 1,
|
||||
"x": 590,
|
||||
"y": 720,
|
||||
|
|
Loading…
Reference in a new issue