Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update examples #256

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/find_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Find RuuviTags
"""

import os

os.environ["RUUVI_BLE_ADAPTER"] = "bluez"

import ruuvitag_sensor.log
from ruuvitag_sensor.ruuvi import RuuviTagSensor

Expand Down
3 changes: 0 additions & 3 deletions examples/find_tags_async_bleak.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"""

import asyncio
import os

os.environ["RUUVI_BLE_ADAPTER"] = "bleak"

import ruuvitag_sensor.log
from ruuvitag_sensor.ruuvi import RuuviTagSensor
Expand Down
3 changes: 0 additions & 3 deletions examples/get_async_bleak.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import asyncio
import os

os.environ["RUUVI_BLE_ADAPTER"] = "bleak"

import ruuvitag_sensor.log
from ruuvitag_sensor.ruuvi import RuuviTagSensor
Expand Down
4 changes: 4 additions & 0 deletions examples/get_ble_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Get all BLE device broadcasts
"""

import os

os.environ["RUUVI_BLE_ADAPTER"] = "bluez"

import ruuvitag_sensor.log
from ruuvitag_sensor.adapters.nix_hci import BleCommunicationNix

Expand Down
3 changes: 0 additions & 3 deletions examples/get_first_async_bleak.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import asyncio
import os

os.environ["RUUVI_BLE_ADAPTER"] = "bleak"

import ruuvitag_sensor.log
from ruuvitag_sensor.decoder import Df5Decoder
Expand Down
4 changes: 4 additions & 0 deletions examples/post_to_influxdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@
Add new graph to dashboard
"""

import os

from influxdb import InfluxDBClient

os.environ["RUUVI_BLE_ADAPTER"] = "bluez"

from ruuvitag_sensor.ruuvi import RuuviTagSensor

client = InfluxDBClient(host="localhost", port=8086, database="ruuvi")
Expand Down
Empty file modified examples/post_to_mqtt.py
100755 → 100644
Empty file.
3 changes: 3 additions & 0 deletions examples/post_to_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
Requests - pip install requests
"""

import os
from urllib.parse import quote

import requests

os.environ["RUUVI_BLE_ADAPTER"] = "bluez"

from ruuvitag_sensor.ruuvi import RuuviTagSensor

macs = ["F4:A5:74:89:16:57", "CC:2C:6A:1E:59:3D", "BB:2C:6A:1E:59:3D"]
Expand Down
2 changes: 2 additions & 0 deletions examples/print_to_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import os
from datetime import datetime

os.environ["RUUVI_BLE_ADAPTER"] = "bluez"

from ruuvitag_sensor.ruuvi import RuuviTagSensor

# Change here your own device's mac-address
Expand Down
2 changes: 2 additions & 0 deletions examples/print_to_screen_ruuvitag_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import time
from datetime import datetime

os.environ["RUUVI_BLE_ADAPTER"] = "bluez"

from ruuvitag_sensor.ruuvitag import RuuviTag

# Change here your own device's mac-address
Expand Down
3 changes: 0 additions & 3 deletions examples/rx_async.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import asyncio
import os

os.environ["RUUVI_BLE_ADAPTER"] = "bleak"

from ruuvitag_sensor.ruuvi_rx import RuuviTagReactive

Expand Down
3 changes: 3 additions & 0 deletions examples/send_updated_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
"""

import copy
import os
from datetime import datetime, timedelta
from urllib.parse import quote

import requests

os.environ["RUUVI_BLE_ADAPTER"] = "bluez"

from ruuvitag_sensor.ruuvi import RuuviTagSensor

all_data = {}
Expand Down