Hi,
I have an python program in raspberry pi.
it listen for an input (door contat) and it logS the change of state in a dattabase.
Im trying to show in real time the status of the dor ina web page but i cant find the right method.
any sugestion?
Hi,
I have an python program in raspberry pi.
it listen for an input (door contat) and it logS the change of state in a dattabase.
Im trying to show in real time the status of the dor ina web page but i cant find the right method.
any sugestion?
Hi Guiseppe,
If you want to view information in a web page, then you'll need to run a web server somewhere. It will respond back to your web browser with the appropriate information, i.e. web page content, to reflect your door status.
For this task, it doesn't need to be a heavyweight web server (like Apache). You can use something more lightweight (like lightttpd) or even more skeletal (e.g. Python most likely has a web server library, google 'python web server').
However, another question you have to ask yourself, is what is your use-case? If it is to see the state of the door while you're away from home, then running a web server doesn't help you because it will be on your private home network, invisible to the outside world. You could attempt to open ports, but you're then into the realm of having to put a lot of effort into security. Maybe even a DMZ (i.e. a segment of your home network that restricts access into the rest of your home network).
If your use-case is to be able to see the door status from outside your home network, then consider not running a web server, and instead using a cloud service. There are plenty to choose from, some are chargeable, some are free for small quantities of events or devices. Usually it entails registering and getting a key to send data in the form of a HTTP request. An example (I've not used it, it is not a recommendation, just an example) is Cayenne.
I already have a web server installed, actuali it dipays the data colected
in a jquery datatable,
But i need a script thas makes chages to a html page,
For example, if the door is closed the pagae can show a red box whi the
word closed and whe is open a green box with te word open
.
I already have a web server installed, actuali it dipays the data colected
in a jquery datatable,
But i need a script thas makes chages to a html page,
For example, if the door is closed the pagae can show a red box whi the
word closed and whe is open a green box with te word open
.
Hi Guiseppe,
It sounds like a conventional db+web server install. If you're talking about a typical web server (e.g. Apache) then use something like php, there should be many examples online how to access a database and display the html content of your choice. The modern 'appliance' approach is not to use such a large web server in a small electronic device, and instead a more lightweight web server is used, e.g. google 'nodejs web server'.