updated readme
This commit is contained in:
parent
4f677ba149
commit
5095b2faf0
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 40 KiB |
@ -4,11 +4,14 @@ Python gateway for the [custom firmware](https://github.com/atc1441/ATC_MiThermo
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
**Features:**
|
||||||
|
- [DONE] Make in runnable in a docker container (because only cool people are using docker)
|
||||||
|
|
||||||
**TODOs:**
|
**TODOs:**
|
||||||
- [WIP] Can run on Raspberry Pi (3, 4, zero w) or any other Linux driven hardware which has BLE and WiFi support
|
- [WIP] Can run on Raspberry Pi (3, 4, zero w) or any other Linux driven hardware which has BLE and WiFi support
|
||||||
- [WIP] Storing temperature, humidity and battery state as json in a text file
|
- [WIP] Storing temperature, humidity and battery state as json in a text file
|
||||||
- [WIP] Implement a loop for fetching the data every x minute
|
- [WIP] Implement a loop for fetching the data every x minute
|
||||||
- [DONE] Make in runnable in a docker container (because only cool people are using docker)
|
- [WIP] Make discoveries async
|
||||||
- [TODO] Make docker image smaller. I mean shiiit 1GB D: should be possible to be under 500MB
|
- [TODO] Make docker image smaller. I mean shiiit 1GB D: should be possible to be under 500MB
|
||||||
- [TODO] Make a microPython version for using the raspberry pico w or any other microcontroller with BLE and WiFi support
|
- [TODO] Make a microPython version for using the raspberry pico w or any other microcontroller with BLE and WiFi support
|
||||||
- [TODO] Collect data from multiple devices/gateways
|
- [TODO] Collect data from multiple devices/gateways
|
||||||
@ -55,3 +58,7 @@ Run docker container. Killing the hosts bluetooth service is needed to access it
|
|||||||
```bash
|
```bash
|
||||||
sudo sh run_docker.sh
|
sudo sh run_docker.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### MicroPython for MicroController
|
||||||
|
|
||||||
|
Coming when I develop it...
|
||||||
|
|||||||
0
bluetooth tools/search_for_blc.py
Normal file
0
bluetooth tools/search_for_blc.py
Normal file
0
bluetooth tools/search_for_ble.py
Normal file
0
bluetooth tools/search_for_ble.py
Normal file
@ -1 +1,2 @@
|
|||||||
bluepy
|
bluepy
|
||||||
|
pyyaml
|
||||||
2
python/src/devices.py
Normal file
2
python/src/devices.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import yaml
|
||||||
|
|
||||||
8
python/src/devices.yml
Normal file
8
python/src/devices.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
devices:
|
||||||
|
- "A4:C1:38:83:05:E8":
|
||||||
|
name: "My Sensor"
|
||||||
|
room: "My Room"
|
||||||
|
|
||||||
|
- "...":
|
||||||
|
name: "..."
|
||||||
|
room: "..."
|
||||||
@ -1,3 +1,5 @@
|
|||||||
|
import asyncio
|
||||||
|
from threading import Thread
|
||||||
from bluepy.btle import DefaultDelegate
|
from bluepy.btle import DefaultDelegate
|
||||||
from bluepy.btle import Scanner
|
from bluepy.btle import Scanner
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@ -16,8 +18,9 @@ class ScanDelegate(DefaultDelegate):
|
|||||||
global devices
|
global devices
|
||||||
|
|
||||||
for (sdid, desc, val) in dev.getScanData():
|
for (sdid, desc, val) in dev.getScanData():
|
||||||
if self.is_temperature(sdid, val) and self.is_atc_device(dev):
|
if self.is_temperature(sdid, val):
|
||||||
data_obj = Data(self.parse_data(val))
|
data_obj = Data(self.parse_data(val))
|
||||||
|
if self.is_atc_device(dev, data_obj):
|
||||||
devices.append([dev, data_obj])
|
devices.append([dev, data_obj])
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -27,14 +30,13 @@ class ScanDelegate(DefaultDelegate):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_atc_device(dev):
|
def is_atc_device(dev, data_obj):
|
||||||
global devices
|
global devices
|
||||||
if 'A4:C1:38' not in dev.addr.upper(): return False
|
if 'A4:C1:38' not in dev.addr.upper(): return False
|
||||||
device_found = False
|
|
||||||
# print(devices.count(dev.addr.upper()))
|
|
||||||
for device in devices:
|
for device in devices:
|
||||||
if str(device[0].addr) == str(dev.addr): return False
|
if str(device[0].addr) == str(dev.addr): return False
|
||||||
print("Device %s (%s), RSSI=%d dB" % (dev.addr.upper(), dev.addrType, dev.rssi))
|
print("Device %s (%s), RSSI=%d dB" % (dev.addr.upper(), dev.addrType, dev.rssi))
|
||||||
|
print(f'\tTemp: {data_obj.temperature}°C, Humid: {data_obj.humidity}%, Batt: {data_obj.battery_percent}%\n')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@ -10,7 +10,7 @@ if len(devices) > 0:
|
|||||||
device = device_list[0]
|
device = device_list[0]
|
||||||
|
|
||||||
data:Data
|
data:Data
|
||||||
print(f'Temp: {data.temperature}°C, Humid: {data.humidity}%, Batt: {data.battery_percent}%')
|
# print(f'Temp: {data.temperature}°C, Humid: {data.humidity}%, Batt: {data.battery_percent}%')
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user