Trying to get IOS Notifications using Bluetooth (RPI) - python

I converted my RPI into a hub for my room(it rests upon the wall and shows the current time, weather, what Music is playing(shairport-sync), and a spot for notifications.
From my personal experience, I've always noticed that bluetooth devices -- like smart watches and cars can read notifications. So I had an idea to connect my RPI to my iPhone and read the notifications coming from my phone. However though, I've made very little head away in implementing this.
So far, I have set up a separate machine that off hands all of the bluetooth stuff so the RPI has room to breathe. Other than that though I cannot figure out how to connect to iOS, subscribe to notifications, and retrieve them. I have looked into this topic extensively and have found many articles talking about ASCN, subscribing to certain Apple Services, using a MAP profile, and a whole lot of stuff about GATT Servers but these articles lack practical steps or any headers on where to get started.
I've been using various python libraries(pybluez, bleak, etc) in conjugation with BlueZ to try to connect and retrieve iOS Notifications using bluetooth. Many of the Articles and posts about this topic usually involves a BLE device communicating with an app in iOS which isn't what I need.
TLDR; : I need help/a point in the right direction to pairing and subscribing to bluetooth iOS notifications using Python.

Related

Is there a way to quit an app when a certain device is physically connected/disconnected to my MacBook?

I have a MacBook and a Thunderbolt hub. There's an app called "BetterDummy" for enabling Hi-DPI when connected to display via the hub. I always open it when I connect the hub. However, I don't want it to be still open after I disconnect it.
Out of curiosity, is there any way that I could detect if devices are connected to the system? What I want is to open the app when connected to the hub, while quitting it if I disconnect the hub. It will be great if this can be coded in Python, but any will do! Thanks for any help!
What I have researched
Many articles are talking about searching devices in the network, but I want to search for physically connected devices. Maybe like a "service" that can detect it in the background (I put a quote here because I'm not familiar with the term service. my understanding of service is something that runs based on system events in the background)
There's something called system_profiler on mac that can list all the USB devices connected, but again, I want it to do "automatically" (e.g. check it every x seconds, if disconnected, quit the app).
I didn't see any related actions in Apple's Shortcuts app.

Raspberry Pi web server that controls hardware

First, thank you all for your useful posts. I can usually find what I need from SE without needing to make a post.
I'm hoping to make a timer/sensor device that I can control from a web browser.
I'm planning to hook up a set of sensors by USB or pinouts to a Raspberry pi, then having the Pi host a web server. I have experience writing web servers from scratch in python, so I intend to use python as my programming language for this application as well.
I want to be able to visit the server from another device that will run at a time-keeper's station. By selecting options on the web site, you could control the display portion of the timer or the values of variables (timer reset) also the sensors could trigger update events to show information on the web page.
My primary obstacle in this case is the hardware interface. I imagine I would need to look up how sites like OMSI allow users to control the motors that move their webcam, or other online control of hardware.
What should my search terms be, or do you know of any libraries for python to read and write to external (adafruit-style) sensors?
Thanks!
Anthony
(https://i.stack.imgur./RzWIl.png)
"Raspberry pi python gpio" "Raspberry pi python i2c" "Raspberry pi python spi"

MQTT broker and client on the same RPI

So I'm building a system where I scan a RFID tag with a reader connected to a Raspberry Pi, the RFID tag ID should then be sent to another "central" RPI, where a database is checked for some info, and if it matches the central Pi sends a message to a lamp (also connected to a Pi) which will then turn on. This is just the start of a larger home-automation system.
I read about MQTT making it very easy to make more RPIs communicate and act on events like this. The only thing I am wondering about, but can't find documented on the internet, is whether the central Pi in my case can act like the broker, but also be subscribed to the topic for the RFID tag ID, check the database and then publish to another topic for the light.
Purely based on logical thinking I'd say yes, since the broker is running in the background. Thus I would still be able to run a python script that subscribes/publishes to, I'm guessing, localhost instead of the central Pi's IPaddress and port.
Can anyone confirm this? I can't test it myself yet because I have just ordered the equipment, and am doing lots of preparation-research.
You can run as many clients as you like on the same machine as the broker (You could even run multiple brokers as long as they listen on different ports). The only thing you need to do is ensure that each client has different client id

How to send wireless sensor data through a firewall bidirectionally without opening a port using Python?

I'm new to this forum and relatively new to python but have been playing around with sockets/google app engine/django etc… I'm at a loss on how to best design this app and what tools to use for it. Any people with more exp
Hardware: I have a Raspberry Pi behind a firewall that collects wireless sensor data. I would like to access that data from an outside web server (aka google app engine or ec2 server).
Goal: The goal is to have users in different homes (like my mom, grandpa etc living separately with their own pi's) be able to check their data on the web on a centralized server. I should also be able to initiate actions on the Pi's so the data should be sent bi-directionally. Ideally without having to open up firewall ports (dummy proof).
What I did so far:
I was able to create sockets on the PI to send data to a django server (ec2) but I had to open ports for that.
Questions:
I'd like to do this with python, no open ports, bidirectional data.
How do you deal with failsafes such as:
The internet going down.
Missing server readings.
Power outages.
Could this be solved just by syncing a database between the Pi and web server?
I realize this is a very broad question but perhaps it's less about the exact tools and more about the techniques one would use for this particular type of project? Tools, techniques, paradigms or general experiences are all welcome.
Thanks everyone,
David

Move data from Raspberry pi to a synology diskstation to present in a webpage

I'm looking for ideas, on how to display sensor data in a webpage, hosted by a Synology Diskstation, where the data comes from sensors connected to a Raspberry pi. This is going to be implemented in Python.
I have put together the sensors, and have these connected to the Raspberry. I have also the Python code, so I can read the sensors. I have a webpage up and running on the Diskstation using Python. But how do I get the data from the rasp to the Diskstation. The reading is just done, when the webpage is displayed.
Guess some kind of WebServices on the Rasp ? I have looked at Pyro4, but doesn't look like it can be installed at the Diskstation. And I would prefer not to install a whole WebServer Framework on the rasp.
Do you have a suggestion ?
I'm not experiment on this topic but what I would do is setup a database in between (on the Synology rather than on the Raspberry Pi). Let's call your Synology server, and Raspberry Pi a sensor client.
I would host a database on the server, and push the from the sensor client. The data would be pushed either using an API through webservices or a more low level if you need it faster (some code needed on server side for this) or, since the client computer is under your control, it could directly push in the database.
Your concrete choice between database, webservice or other API depends on:
How much data have to be pushed?
How fast data have to pushed?
How much do you trust your network?
How much do you trust your sensor client?
I've never used it but I suggest you use SQLAlchemy for connecting to the database (from both side).
If in some use case the remote server can be down, the sensor client would store sensor data in some local file and push them when the server come back online.

Categories