I'm new to Angular and MVC. My "Learn Angular" project is client for a home automation system. The system's server supports plug-ins (written in Python--something else to learn :-))
I have built the client with a responsive design (Bootstrap) and can get a list of all devices and their values using their RESTAPi (I'm using $http), so I'm reasonably comfortably with Angular basics now
Now I want to add functionality that will update the clients on a device statues change. (I don't want to do use polling) The plug-in architecture lets me create a plug-in that registers for changes in device states.
So here's my scenario:
I have 5 touch screen (mix of Android and iOS) around the house. All will be running my client
Let's assume they all have the lighting page shown, which has the
status of all lights (on/off/dim level).
Someone changes the living room light from 70% to 30%. This could be done by one of the clients, the native app on server or the light switch itself.
The device status on the server will change and generate a notification that my plug-in will receive
I need to update the state of the living room light on all 5 clients to show the living room light is now 30%
Not sure how I'd go about this. I'd like to do the minimum possible in Python and have no objections to using something like Node to send the notifications of that helps.
So I'm looking for suggestions on how to send this devices status change to all 5 clients (without a page refresh or polling). Can anyone help with some suggestions?
Regards
Mark
Related
Problem
I bought these LED's lights off Amazon that you setup with Smart Life, which has Google/Alexa/IFTTT integration. Which is great but when I go to IFTTT and I try to setup a webhooks to trigger the lights turning on IFTTT says the devices are not compatible and to check with the manufacturer (IFTTT has Smart Life compatibility but apparently not all devices are). I have sent out a request to the manufacturer about compatibility with IFTTT, but in the mean time I'm trying to brain storm of a way to get this to work.
Goal
I have an NFT scanner program running on Python that I would like to have the NFT scanner hit a webhook URL and it trigger changing these Smart Life lights to a certain color. Is there any other way to do this given that it does work with Google Assistant and is setup in my Google Home?
Lights for reference: https://www.amazon.com/gp/product/B07VZM3BJZ
The trick with the non-compatible SmartLife stuff is to create separate Tap-to-Run tasks in SmartLife for turning the equipment ON and OFF. IFTTT can access the Tap-to-Runs even when it cannot access the asset itself. Remember to update the link to SmartLife to include the newest additions.
Name the tasks in a logical manner because you will be getting a lot of them. Something like SL Porch ON works for me.
I have a BrowserComponent that loads a web page that does something by ajax every few seconds (suppose thirty seconds, I don't remember how many). These ajax requests get updates and keep the login.
My question is how to make the web page working when the app is in the background: sometimes the app works fine, other times it's killed by the o.s. when it's in the background (I suppose so because sometimes, when I reopen the app, it restarts).
There are apps that are never killed, such as media players, e-mail clients, etc.: how can I make my app always running in background? Of course I suppose that the CPU loading of my app is very low, but I didn't find any way to compare its cpu loading with other apps.
Thank you very much for any help.
You would find that hard to do with a web browser. Various OS's have different behaviors but even Android which used to be the least restrictive is moving towards a more restrictive background behavior to conserve battery life.
In the misc section of the developer guide we discuss the background modes e.g. background fetch etc.
You can do that from Codename One code which compiles to native but you can't leverage that from JavaScript as it doesn't give the OS enough control.
I am running an apache2 graphite host from an Orange Pi One, having written a service to translate and send data from sensors on the GPIO to the carbon line receiver. My project is to incorporate all the I/O from the device into a dashboard.
There are loads of graphite dashboards, but I can't find one that has a simple video stream applet/plugin.
I have searched graphite-web github and can easily adapt dashboard.html, but I am not sure whether the entire file is a placeholder, and whether any additions would render properly after all the javascript has run and rendered the page. It would seem I might need to reverse engineer the javascript, which seems quite an effort for the simple task I want.
If I can figure out the video stream code for the CSI camera, then I can adapt it to modify the dashboard with all the other data I want to display.
So, I am really looking for some guidance on getting started with dashboard code modification?
You can use the text panel to add HTML content to the dashboard.
I am re-making a Console game, that my boss made a considerably long time ago, in Silverlight. It's totally text based. In the Console version, each computer that had it installed had its own map, which was divided into a grid of rooms.
What I want to do is make the map global; when anybody runs the Silverlight version, they will all see the same map. There is no changing that goes on in the map, only new rooms being added to the map.
So, currently I'm storing all the data in IsolatedStorage, which is obviously not global. How should I store the data and retrieve it so that everybody playing can see the same map?
If it helps any, the server that it will be hosted on is a linux server, and has MySQL.
See this answer to a person who was trying to do something very similar (he wanted high score data, you want map data): High Scores self contained in .xap
The fact that you are running a linux server complicates things a little - instead of running a WCF or asmx service, you could consider a java based web service, or just make a normal HTTP page that queries the MySQL database and returns data which your Silverlight app can request and consume (this is still a "web service", albeit a very primitive one).
I have a very critial business application presently running using Winforms.
The application is a very core UI shell. It accepts input data, calls a webservice on my server to do the computation, displays the results on the winforms app and finally send a print stream to the printer.
Presently the application is deployed using Click-once.
Moving forward, I am trying to contemplate wheather I should move the application into a Silverlight application. Couple of reasons I am thinking silverlight.
Gives clients the feel that it is a cloud based solution.
Can be accessed from any PC. While the clickonce app is able to do this as well, they have to install an app, and when updates are available they have to click "Yes" to update.
The application presently has a drop down list of customers, this list has expanded to over 3000 records. Scrolling through the list is very painful. With Silverlight I am thinking of the auto complete ability.
Out of the browser - this will be handy for those users who use the app daily.
I haven't used Silverlight previous hence looking for some expert advice on a few things:
Printing - does silverlight allow sending raw print data to the printer. The application prints to a Zebra Thermal label printer. I have to send raw bytes to the printer with the commands. Can this be done with SL, or will it always prompt the "Print" dialog?
Out of browser - when SL apps are installed as out of browser, how to updates come through, does the app update automatically or is the user prompted to opt for update?
Printing -- using the PrintDocument API your user will be prompted for a print dialog. Currently using that API there is no way to suppress this. It isn't ideal for high-volume thermal situations (like pharmacies, shipping warehouses, etc.). You could use the trusted application mode and peek out into COM and do whatever you want with the printer.
The update happens when the application asks for it. There is an API to use and, once called, if an update exists it is downloaded -- no prompt to the user as an option. If an update is found you can alert the user to restart or that on the next restart they will have the updated application.
Autocomplete is not something that can only be done in Silverlight. Your ClickOnce app is already out-of-browser. And printing via raw bytes to a thermal printer is something that would not be easily engineered in Silverlight.
Not trying to sound negative, but in sum it sounds like you're better off simply working on enhancing the app that you already have.