Python, Rpi server status notifier - python

--First month in programming; be gentle with me--
I'm looking to build a short application using python to run on an RPi; the idea is to ping our company owned servers individually and eventually have them return as LED status lights. For now though; I would like it to broadcast a desktop notification to specific Macs on the same network.
I have 0 experience with python or programming general. Where should I start?

For learning Python there are too many very good web ressources easily found on the net, so I don't mention them here. For your nice little project for the Raspi you should get familiar with the python module called RPi.GPIO. With it you can easily turn on & off your LEDs depending on the ping response of your company servers.

Related

Approaches to automatic Plug and Play Raspberry PI WebSockets

This question is more about advice on how to approach the best solution and possible frameworks to look at.
Desired Result
I am currently attempting to create a very basic plug and play raspberry-pi which can be controlled via an API to perform various tasks such as stream a webcam or turn an led on. The device should connect to anyway wifi and automatically be able to be controlled by the API.
Current Problem
The goal of the app is to create a very easy to use plug and play solution. However I am running to to problem when trying to create a WebSocket on the PI as I cannot seem to be able to access it from an external network. I have looked into automatic port forwarding solutions such as UPnP however all of the results are extremely old. I have also thought about creating the Python WebSocket on a cloud server and use the PI as the client to connect and pass data. Please correct me if I am wrong, however this method does not seem very scalable when there are 10s/100s/1000s of pi's connecting to the same socket.
Any advice would be greatly appreciated.

Communication Between Processes and Machines Python

I'm struggling to design an efficient way to exchange information between processes in my LAN.
Till now, I've been working with one single RPi, and I had a bunch of python scripts running as services. The services communicated using sockets (multprocessing.connection Client and Listener), and it was kind of ok.
I recently installed another RPi with some further services, and I realized that as the number of services grows, the problem scales pretty badly. In general, I don't need all the services to communicate with any other, but I'm looking for an elegant solution to enable me to scale quickly in case I need to add other services.
So essentially I though I first need a map of where each service is, like
Service 1 -> RPi 1
Service 2 -> RPi 2
...
The first approach I came up with was the following:
I thought I could add an additional "gateway" service so that any application running in RPx would send its data/request to the gateway, and the gateway would then forward it to the proper service or the gateway running on the other device.
Later I also realized that I could actually just give the map to each service and let all the services manage their own connection. This would mean to open many listeners to the external address, though, and I'm not sure it's the best option.
Do you have any suggestions? I'm also interested in exploring different options to implement the actual connection, might the Client / Listener one not be efficient.
Thank you for your help. I'm learning so much with this project!

How to connect raspberry to plc via Ethernet?

I have wrote a simple program using Python on RSPPi, that count time between the falling edges, signal is provided by PLC (Rexroth CML40). It works great, but now I want to send more signals from PLC but I don't have any free output spots. So, I think the solution to that is making a connection between Raspberry and PLC through Ethernet. My question is, what should i need to make to receive data from PLC (state of the 3 variables) to Raspberry?
I found this https://wiki.python.org/moin/TcpCommunication but I don't really understand it. Is it Raspberry a server? Right? If yes then how can I make client code work on PLC... It is really incomprehensible to me
You first need to find what Ethernet-based protocols the L40 controller has available. This sales guide shows that some of the IndraMotion software packages include OPC-UA, which is a good option because there is a robust Python OPC-UA library. Your controller may also have the EtherNet/IP add-on module, which would also work. Your distributor or sales rep should be able to point you in the right direction.
The second step is to find a library that allows to you communicate over that protocol. I've personally had success with OPC-UA, many options though. Some Recommendations:
Python OPC-UA
CPPPO — EtherNet/IP

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

What should i use for a Remote Desktop Control?

Hi everybody i'm new to stackoverflow and to python programming :-)
Can somebody point me in the right direction or suggest me a good way to do this..?
The software I'd like to write is a kind of "multiple remote control", it has:
One Server ... whose task is to send his screen to all the clients
Many Clients ... they show the Server's screen and they are all able to control it (there exist a lot of remote control applications which can do this,but not all the clients together i think .. practically one server with many mice :p .. however all the clients will be managed by the server)
Given that I'm new to python i started looking and using these libraries:
wxWidget for the gui
Twisted for the network connection, because it's an easy way to implement a multicast UDP .. but is udp the right choise to send images to all the clients? =/
PIL (Python Imaging Libary) images stuff and to grab the screenshots on the Server machine to send to the clients .. this is the point where I stopped to think to all the possible solutions ... (I wasn't able to send the image to the client, I tried converting it to string but the UDP message was not that big :) )
I've seen many suggest the use of a VNC application .. is it easy to develop my software as described around it (actually i have no idea how..), or grabbing the screen continuously with PIL and sending somehow the images to the clients is an acceptable solution?
Thanks in advance for any help :-)
Take a look at the VNC viewer implemented in Python.
Teamtalk is a Python IM software that also has Remote Desktop access. You can download the source and look at the implementation.

Categories