Proactive notification for thermostat in google smart home - actions-on-google

We are trying to implement temperature monitoring system with our devices. The goal is to have an alert when the temperature exceeds/goes below the set points.
I can see that we can set the temperature limits with the thermostattemperaturesetrange trait.
But there is no way to send a proactive notification with the trait.
Also, it automatically works with Google's Nest thermostats as mentioned here. Just wondering how one would achieve with custom devices.
The sensorState trait also doesn't mention anything about temperature notifications.
Is there any way to have proactive notifications for thermostat or any custom proactive notifications in general?

Proactive notifications for Thermostats are not available right now. We will send your feedback to the smart home team for the feature request of temperature notification . In the meantime, I would suggest to open up a feature request on the public issue tracker.

Related

User TimeZone sensitive push notifications in Flutter app

I am creating a Flutter app where I need to allow the user to receive notifications each day at a scheduled time that they set, and the notifications will honour the timezone where the device is.
The notifications will contain dynamic content, rather than static content like one might use to set a reminder. So, I'm assuming that I need to use push notifications and a server-side function to create the dynamic content. For example, using a Firebase Cloud Function and Firebase Cloud Messaging.
What I don't know is how I might get the user's device timezone and the scheduled time they configured for their daily notifications into the Cloud Function.
Is this possible at the time that the device registers with Firebase Cloud Messaging? Or do I need to store the schedule time and timezone in Firestore and somehow pull it from there?
Any other tips for system components that can facilitate this use case would be much appreciated.
Thanks,
Luke
OK, after doing some more research with Dr Google, I found two very good YouTube videos that look like they will do what I need:
https://youtu.be/D4wgrgb24o0
https://youtu.be/I0r10sk5fuI
Thank you to Tadas Petra.

Have Google Home trigger smart device

I'm developing a smart device that needs to respond to a trigger and take an action. I'm having some trouble however determining what will host the code that fires the trigger. Google Home appears to have events based on time but I can't seem to find anything that can trigger an event based on something like the weather. IFTTT seems like a natural fit but to have customers install IFTTT and then find my applet is a bit cumbersome. I could have my server monitor the condition and fire the trigger but ideally the trigger could be generated on-prem.
So my question... Does anyone have a good suggestion for where to host code that fires a trigger that is sent to a smart device?
*first-time poster so forgive me for any lack of formalities
Automations on Google Home are available for triggering actions but might cover all the use cases you specified. You can create your own system that changes the states of the devices based on your conditions, then report to Google via Report State.

Updating Chat App in Real Time Using APNS (with or without AWS SNS)?

I am writing a messaging app in Swift where people can chat similar to how text messages or other popular chat apps work. The supporting API is on AWS, written in C#.
There are some points of interest here:
Hoping to avoid third party stuff like Firebase, etc, but open to listening to advice
Alert notifications are not desired for now - no popups, banners, etc. Simply want to show message bubbles arrive in real time on one viewcontroller - if and only if the person is staring at the message screen. If they're somewhere else on the app, nothing happens.
We don't want to prompt the user to ask them if they're OK with this app sending notifications because we're not sending them banners or anything visual, aside from a new chat arriving. Is that a requirement with APNS? I feel like this means someone can say NO, and then we have no way to update the chat app in real time, which won't fly.
I assume a simple approach would be some sort of timer/loop that runs from the message viewcontroller, where every second or two it hits the API and asks if there are new messages, but that seems inherently wrong to me - the app must be robust, and there could be thousands or hundreds of thousands of people using this - that's a lot of API requests, and in many cases there could be no new messages, thus a wasted call. This is clearly not the way to go, correct?
Question # 1
I was thinking, then, that I should use APNS, however am not sure if it requires you to prompt the user to ask them for permission to receive anything from Apple? Again my concern is the chat bubbles should come in at real time and don't want to give the user the ability to somehow not see these (breaking the app)
If APNS is the way to go, and I must prompt them, then I assume the flow is I will gather my device ids (created in appdelegate, saved in my C# db, and associated to each message thread) and whenever someone types a message, it goes to my API, I save it in the message database table, and then I send out a message to APNS to everyone's device id.
Apple queues this up, and sends to everyone, and if they're on the screen, then the message comes in.
Is this how I should leverage APNS to achieve what I want?
Question # 2 I've seen others recommend using SNS (in conjunction with APNS) however I don't understand why. Doesn't APNS both act as a proper queue, as well as a notification service, thus invalidating the need to use AWS's SNS/SQS at all? It seems redundant to me but maybe I just don't understand the idea behind why you need both technologies.
Appreciate anyone's time in advance if they can shed some light on this for me!
Thanks!
Question 1
Even if you're using WebSockets (As #stevenpcurtis mentioned), you still need to inform user about the fact that user received message when application is in background/suspended. And yes, you must "force" your user to enable notifications for the application and explain why he needs it. Empirically, if user installs messenger, he understands what are notifications used for and why he enables it.
Question 2
From the mobile perspective SNS will still deliver Push notifications when user receives notification while the application is in background or suspended. From the backend perspective you can use SNS.
Conclusion:
From the mobile perspective you have 2 modes:
Application is active - it's generally up to you how to receive messages. (Web Sockets, pushes, e.t.c.)
Application is in the background or is suspended: You need a tool to inform user about changes without having a control on application. This is the job for Push Notification Service. The way you will send pushes from the backend is up to you.
You can also check This question to get some more information.

Constantly poll server for new JSON from iOS app?

I am trying to write an iOS app that will notify the user on price changes of products I access as JSON information via an API. I want to have a background task that will repeatedly check the server every n minutes for new JSON and send the user a notification if certain conditions are met. What would be the correct way to do this?
As previous posters mentioned, this is better done server side rather than via polling. However, using Apple Push Service to notify the client device is not the ideal solution. The issue is that delivery is not guaranteed (per Apple) and you cannot confirm delivery. The user could decline push notifications, Apple could decline to send the notification if you are sending too many, etc. You are much better off using a service like PubNub or Pusher, which push notifications to the client in a reliable way and both have iOS APIs. They are very inexpensive. If you wanted to reinvent the wheel and save money, you could look up how they work and write your own version.
You could of course do client side polling, in which case an asynchronous NSOperation is particularly well suited (it will run on a background thread and you can post notifications to NSNotificationCenter when things change). You can find out more about how to implement that here.
This does not work well. Here is a probably better solution:
Set up a server that polls the JSON data source.
When the data source changed, use Apple Push Service to notify the user.
Upon receiving of the notification, start a background fetch session.

How to make a chat system on iPhone?

I'm doing research for making a chat based app for the iPhone (it's not really text chat in the regular sense, but the principles are the same).
Maximum 6 people can be logged into the same chat room at any one time, and the most basic question is how to efficiently check for new messages?
Would I need to simply poll the server periodically? Or is there a way I could trigger an event on the phone from the server whenever there is some new content to pay attention to?
If having to poll all the time, I worry about the resulting lag as each participant will have to wait longer for others before they can post their own responses to others. And, potentially it might also be too much to handle for the server to respond to lots of requests all the time. It would also waste bandwidth, which is not free for the user...
Unfortunately I will not be able to set up a socket server for this app, it has to be based around a regular LAMP configuration.
I think you can either go with push notifications, or XMPP (Jabber) server.
XMPP will allow your iphone app to receive data even when in the background using the new multitasking features (listening for a socket), and i'm pretty sure you should find ready to use servers for LAMP (or at least open source implementations).
Note that the iOS4 multitasking API doesn't support polling in the background, so your only other option should be push notifications. If you're new to push notifications, you can maybe use a service like Urban Airship that might make the process easier.
XMPP sounds good for you idea, i think this is the best technology for Chat. It alos works great in iOS apps.
Maybe this code sample will be helpful to start using XMPP in iOS app - look at this QuickBlox Chat code sample. It demonstrates how to integrate 1-1 Chat, Chat in room into your android application. Also there is guide how it works. I think there will be no problem to integrate it into your application. Otherwise - Comments system below allows to ask any question you want and get fast answer.
Also there is Demo video http://www.youtube.com/watch?feature=player_embedded&v=SncQaJBBW_0 how this Chat works.
In my opinion the best solution is socket, but you say that you can't implement the server side for this.
You could also implement it with push notifications. You can receive the push also when your app is running and send all the data you need inside the push. Usually chat messages are short...
If you don't want to mess with push notifications on the server then the only thing left, as long as I know, is the polling.