How to send command to receipt printers from Django app? - python

I have created a simple POS application. I now have to send a command to the receipt printer to print the receipt. I don't have any code related to this problem as I don't know where to start even. My questions are:
1) Is Windows a good choice for working with receipt printers as every shop I went to use a desktop application on Windows for POS?
2) Is it possible to control the receipt printer and cash register/drawer from a web app?
3) Is there a good reading material for developing POS systems by myself?

For a web app to use a device on the client, it has to go through the browser. I may be wrong, but I seriously doubt this is a built-in feature for receipt printers. I see three options:
1) Find/make a normal printer driver that works with your receipt printer, put it on the client box, and just use the normal print js commands.
2) Find/make a browser plugin that talks to the printer and exposes an API.
3) Find/make a simple web app that talks to a server-connected receipt printer (probably via native code execution or script call), and install it on each POS, with CORS to allow remote origin; then just post to that on 127.0.0.1:whatever from the webapp client script.
Side note: I seriously discourage connecting a POS to anything resembling a network any more than absolutely necessary. Every outbound network request or trusted network peer is a potential attack vector. In short, I would never use django or any other web app for physical POS software.

Related

How can I give input to my computer from my phone?

I am trying to create a python program that takes input of what homework assignments I have and stores all of that information so that I can send a notification to my phone when assignments are coming up. I want to be able to give input from my phone throughout the day and cant seem to find a way to interact with my script on my computer from my phone. Any ideas? Ps: if you know a way that I can send notifications to my phone that would also be cool.
It looks like you should create a classic client/server architecture. This is quite a big task. Your program running on your Windows computer acts as a server waiting for client (mobile application) requests. I propose to create a widely used REST API service using e.g. the Flask framework (server side) and use the Retrofit framework for the Android application.
Remember that when using the application on the Internet, you will have to ensure the availability of the server.
To send notifications from the server to the app, use Firebase Cloud Messaging

how to build notification pop up system from cloud to local computer

I'm trying to build a notification system that would be triggered initially from an api call made on the cloud, and should trigger a notification on one of my agents' pc (assuming running windows 10)
I'd like to do that in python as this is my knowledge
How should I structure this ?
The hardest part I can't figure out and couldn't find anything online is how to link the "local" pc to the "server"/cloud system (i'm using aws if that is useful) which would store the notification and dispatch them for each one of my agent.
My ultimate goal is to use a phone solution like aircall and to show the contact name of the caller through a notification popup in windows (aircall does offer that natively but can't access my contact datrabase so i'm trying to override the same function of displaying the caller name)
any help or suggesiton appreciated
One solution could be to build a simple ElectronJS frontend app that runs on your agents' computer AND a Python web server that listens to Aircall's Webhook events.
The web server would listen to call.ringing_on_agent Webhook events sent from Aircall and send a WebSocket push event (using Pusher for example) to your ElectronJS app.
The ElectronJS app installed by your agents would listen to WebSockets from your Python web server and would trigger a native Windows notification with the information you want (check the doc here).

how to automate or verify smart home devices

Automation of Smart Home devices
To verify smart home devices like end-to-end (from mobile App to smart home devices).
what are the automation framework you suggests.
Mobile App - developed Appium with python and Robot
Product - REST
API calls. Smart Devices - Verification of lights ON/OFF, color
change, etc
Can you please suggest or add any better methods to verify end-to-end.
EG: Image comparison, any other method.
Actually it depends on two things:
1- How the devices are calling each other. And whats is the main controller.
2- Whats you purpose of testing? Testing the devices themselves or testing the functionality of the control panel and softwares?
About CP and softwares:
If the system using API > Of course api-testing is required
If there are a panel and you can access it with browser> Using selenium for desktop and chromedriver for mobile browser
If there are a mobile app, using Appium
etc.
For the system itself, it is completely another field and responsibility of the electronic and robot engineers. And depends on hardwares. But the general way is I/O checking. Means that engineers check the input signal with device actions and vice-versa.
Hope this helps.

How would I allow my IOS app communicate with my python script

I'm developing a product where it shows information about stuff, the product involves a raspberry pi which automatically runs a python program on boot. When it's the users first time using this product they will have to set it up (log into their account etc.). I'd like it for the IOS app to recognize that the product is nearby and allow the user to enter the necessary data (WiFi information, login credentials, etc.) for that product through the app on their phone.
Basically, what I'm trying to ask is that is there any way where I can exchange data between my IOS app and my python program, running on my raspberry pi? I can't do anything through databases since there would be no way of knowing which device needs to connect to what, so I'm guessing something like Bluetooth, just to send the first bits of data (like Wifi information) to get the two linked?
MORE INFO:
An example would be setting up a device like Alexa, how does Alexa connect to your devices to obtain Wifi information so that it can do everything else by itself?
Thanks, Nathan.
If you want to prototype a solution quickly, try Blynk. I've managed to do this type of link using NodeJS and a Raspberry Pi with Blynk previously but their web page suggests you could also use Python or MicroPython. The downside is that, beyond doing basic UI elements, you need to pay for it.
Another approach is to set up a WiFi access point with a web-based system that supports configuration. An example of a device that does this is the open source energy monitor. It might be the case that you can look at how they set up their AP and web server as it is all open source.

Python application communicating with a web server? Ideas?

I'm looking for a bit of web development advice. I'm fairly new to the area but I'm sure there are some gurus out there willing to part with some wisdom.
Objective: I'm interested in controlling a Python application on my computer from my personal web hosted site. I know, this question has been asked several times before but in each case the requirements were a bit different from my own. To reduce the length of this post I'll summarize my objective in a few bullet points:
Personal site is hosted by a web hosting company
Site uses HTML, PHP, MySQL, Python and JavaScript, the majority of everything is coded by me from the ground up
An application that is coded in Python will run on a PC within my home and will communicate with an Arduino board
The app will receive commands from the internet to control actuation via the Arduino, and will transmit sensor data back to the site (such as temperature)
Looking for the communication to be bi-directional, fast and secure
Securing the connection between site and Python app would be most ideal
I'm not looking to connect to the Python application directly, the web server must serve as the 'middle man'
So far I've considered HTTP Post and HTML forms, using sockets (Python app would run as a web server), an IRC bot and reading/writing to a text file stored on the web server.
I was also hoping to have a way to communicate with the Python app without needing to refresh the webpage, perhaps using AJAX or JavaScipt? Maybe with Flash?
Is there something I'm not considering? I feel like I'm missing something. Thanks in advance for the advice!
Just thinking out loud for how I would start out with this. First, regarding the website itself, you can just use what's easiest to you, or to the environment you're in. For example, a basic PHP page will do just fine, but if you can get a site running in Python as well, I'd prefer using the same language all over.
That said, I'm not sure why you would need to use a hosted website? Given that you're already forced to have a externally accessible PC at home for the communication, why not run a webserver on that directly (Apache, Nginx, or even something like CherryPy should do)? That webserver can then communicate with the python process that is running to control your Arduino (by using e.g. Python's xmlrpclib). If you would run things via the hosting company, you would still need some process that can handle external requests securely... something a webserver is quite good at. Just running it yourself gives you all the freedom you want, and simplifies things by lessening the number of components in your solution.
The updates on your site I'd keep quite basic: commands you want to run can be handled in the request handlers of the webserver by just calling the relevant (xmlrpclib) calls. Dynamically updating the page is best done by some AJAX calls I reckon. Based on your story, these updates are easily put in a JSON object, suitable for periodically updating only the relevant segments of your page.

Categories

Resources