added Nexus Temperature Sensor
parent
82cd9f2a1f
commit
461cae49a6
@ -0,0 +1 @@
|
||||
*.pyc
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"python.linting.pylintEnabled": true,
|
||||
"python.linting.enabled": true
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
import protocols.Nexus
|
||||
|
||||
nexus = protocols.Nexus.Nexus_TempHumidity()
|
||||
print(nexus.generate(244, 1, 55, 100))
|
@ -0,0 +1,19 @@
|
||||
|
||||
class Nexus_TempHumidity:
|
||||
def __init__(self):
|
||||
self.test()
|
||||
def test(self):
|
||||
print("Nexus Temperature & Humidity Sensor")
|
||||
def generate(self, id=244, channel=1, temp=30, humidity=100):
|
||||
packet = [
|
||||
(id >> 4) & 0x0f,
|
||||
id & 0x0f,
|
||||
7 + channel,
|
||||
(temp >> 8) & 0x0f,
|
||||
(temp >> 4) & 0x0f,
|
||||
temp & 0x0f,
|
||||
0x0f,
|
||||
(humidity >> 4) & 0x0f,
|
||||
humidity & 0x0f
|
||||
]
|
||||
return packet
|
Loading…
Reference in New Issue