Connect with us

Tech

Get Google Nest alarms and timers as notifications

Avatar

Published

on


TL; Using DRHome Assistant and Node-RED Receive actionable notifications about Google Home alarms and timers on your Android smartphone. The notification shows all the information, is grouped and has a countdown.

I’m a big fan of Google (Nest) smart devices and have multiple hub and mini devices in my smart home setup. Use them in combination with Home Assistant and Node-RED to control all devices and automation flows.

Alarms and timers

The device’s alarm and timer features are the ones I use most often and I use them every day. They work fine, but they lack some features to make them great.

I don’t see it on my phone I don’t notice the alarm / timer ringing when my phone is ringing and I’m not in the same room Home Assistant Google Home integration

This week we discovered a new community integration called “Google Home” that exposes alarms and timers as HA sensors.

Home Assistant Google Home Custom Component I installed it via HACS, but it works very well and the alarm and timer sensor entities are created for each device.

I was wondering if I could use it for some new automation to add more features, especially if they could be used as notifications on my phone.

goal

Show alarms and timers as phone notifications Countdown until the alarm sounds Notifications appear when notifications close Close notifications and alarms / timers need to be removed Remove notifications if deleted on Google devices Must node-RED

I use Node-RED for all the automation and I like the way the flow is visualized. Often referred to as a low-code solution. As a developer, I also like the option to apply code logic.

What you see next is the final result of trial and error programming. Normally I start with one sensor input and a normal flow. Then you often tweak this to transform it into a reusable subflow.

What will the main flow look like:

Ultimately, we needed one subflow to control everything, using multiple alarm and timer sensors as inputs.

Subflow

The upper flow processes all inputs and the lower flow processes cleared notifications.

Analyze input from topflow sensor Determine if it is an alarm sensor or timer sensor Cache active items (including type and sensor information) in memory Create / update notification message for each active item Inactive Message to the call service node that sends a clear_notification message for each item

Let’s start with the “Parsealarms & timers” function node, which does all the tedious work. Use the Function node’s Setup tab to set some defaults used in the flow.

// Set type defaults constdefaults = {timer: {id:’timer_id’, label:”, items:’timers’, name:’Timers’, deleteService:’delete_timer’}, alarm: {id:’alarm_id ‘, label:”, items:’alarms’, name:’Alarms’, deleteService:’delete_alarm’},} flow.set (‘defaults’, defaults); Enter full screen mode Exit full screen mode

“Features” tab

const defaults = flow.get (‘defaults’); const service = env.get (‘service’); const message = []; Type =”; if (! msg.data) {returns null;} // Determine type: alarm or timer if (typeof msg.data.new_state.attributes.timers! ==’undefined’ || typeof msg.data.old_state.attributes.timers! ==’undefined’) {type =’timer’;} else if (typeof msg.data.new_state.attributes.alarms! ==’undefined’ || typeof msg.data. old_state.attributes.alarms! ==’undefined’) {type =’alarm’;} else {returns null;} const typeValues ​​= defaults[type]; // Create an alarm / timer item that can be used by the service constcreateItem = (item, sensor, type, device) => {const doneTime = new Date (item.fire_time * 1000) .toTimeString (). substr (0, 5); Label = `$ {typeValues.label}`; Vibration =”; Chronometer = true; if (item.status ===’ringing’) {label = item.label? `$ {label} $ {item.label} RINGING`: `$ {label} RINGING`; Vibration = ‘100, 1000, 100, 1000, 100, 100, 1000, 100, 1000, 100′; Chronometer = false ;} else {label = item.label? `$ {label} $ {doneTime} $ {item.label}`: `$ {label} $ {doneTime}`;} let title = label; if (item.duration) {title = `$ {label} ($ {item.duration}) `;} return {id: item[typeValues.id], Sensor: Sensor, Device: Device, Type: Type, Status: item.status, Data: {Title: Title, Message: `$ {Device}`, Data: {Tag: Item[typeValues.id], Chronometer: Chronometer, When: item.fire_time, sticky:’true’, Group: typeValues.name, vibrationPattern: Vibration}}}}; const mapItems = (arr) => {return arr.map ((item)) => {return createItem (item, msg.data.entity_id, type, msg.data.old_state.attributes.friendly_name)})} const activeItems = mapItems (msg.data.new_state.attributes)[typeValues.items] || []) .Filter (item => item.status! ==’none’); const cachedItems = flow.get (‘cachedItems’) || new Map (); // Update or create notifications for active items activeItems .forEach ((item) => {messages.push ({payload: {service: service, data: item.data}}); cachedItems.set (item.id, item);}) // Expired / Deleted Clear notification cachedItems.forEach ((item, id) => {const findItem = activeItems.find (newItem => newItem.id === id); if (! findItem && item.sensor === msg.data.entity_id) ) {Messages.push ({payload: {service: service, data: {message:’clear_notification’, data: {tag: id}}}}); cachedItems.delete (id);}}) flow.set (‘ cachedItems’, cachedItems); // Send the notification as a stream message. ForEach ((msg) => node.send (msg)); // All done node.done (); Enter full screen mode Full screen mode Exit bottom flow Find clear notifications Search in cache If found, call delete_alarm / timer service Delete items from cache constantcachedItems = flow.get (‘cachedItems’); const defaults = flow.get (‘ defaults’); // Search for cleared items constfindItem = cachedItems.get (msg.payload.event.tag); if (! findItem) {return null} node.send ({payload: {service: default)[findItem.type].deleteService, data: {entity_id: findItem.sensor,
[defaults[findItem.type].id]: findItem.id}}}) // Clean up cachedItems.delete (findItem.id) ;. flow.set (‘cachedItems’, cachedItems); node.done (); Enter full screen mode Exit full screen mode Usage Import subflow with NR: Next, edit the environment variables for the service. Add a subflow and connect some alarm and timer sensors as events_state nodes. When all is done, create an alarm / timer on your Google Home device and try it out. You will receive a notification on your smartphone within seconds.

What Are The Main Benefits Of Comparing Car Insurance Quotes Online

LOS ANGELES, CA / ACCESSWIRE / June 24, 2020, / Compare-autoinsurance.Org has launched a new blog post that presents the main benefits of comparing multiple car insurance quotes. For more info and free online quotes, please visit https://compare-autoinsurance.Org/the-advantages-of-comparing-prices-with-car-insurance-quotes-online/ The modern society has numerous technological advantages. One important advantage is the speed at which information is sent and received. With the help of the internet, the shopping habits of many persons have drastically changed. The car insurance industry hasn't remained untouched by these changes. On the internet, drivers can compare insurance prices and find out which sellers have the best offers. View photos The advantages of comparing online car insurance quotes are the following: Online quotes can be obtained from anywhere and at any time. Unlike physical insurance agencies, websites don't have a specific schedule and they are available at any time. Drivers that have busy working schedules, can compare quotes from anywhere and at any time, even at midnight. Multiple choices. Almost all insurance providers, no matter if they are well-known brands or just local insurers, have an online presence. Online quotes will allow policyholders the chance to discover multiple insurance companies and check their prices. Drivers are no longer required to get quotes from just a few known insurance companies. Also, local and regional insurers can provide lower insurance rates for the same services. Accurate insurance estimates. Online quotes can only be accurate if the customers provide accurate and real info about their car models and driving history. Lying about past driving incidents can make the price estimates to be lower, but when dealing with an insurance company lying to them is useless. Usually, insurance companies will do research about a potential customer before granting him coverage. Online quotes can be sorted easily. Although drivers are recommended to not choose a policy just based on its price, drivers can easily sort quotes by insurance price. Using brokerage websites will allow drivers to get quotes from multiple insurers, thus making the comparison faster and easier. For additional info, money-saving tips, and free car insurance quotes, visit https://compare-autoinsurance.Org/ Compare-autoinsurance.Org is an online provider of life, home, health, and auto insurance quotes. This website is unique because it does not simply stick to one kind of insurance provider, but brings the clients the best deals from many different online insurance carriers. In this way, clients have access to offers from multiple carriers all in one place: this website. On this site, customers have access to quotes for insurance plans from various agencies, such as local or nationwide agencies, brand names insurance companies, etc. "Online quotes can easily help drivers obtain better car insurance deals. All they have to do is to complete an online form with accurate and real info, then compare prices", said Russell Rabichev, Marketing Director of Internet Marketing Company. CONTACT: Company Name: Internet Marketing CompanyPerson for contact Name: Gurgu CPhone Number: (818) 359-3898Email: [email protected]: https://compare-autoinsurance.Org/ SOURCE: Compare-autoinsurance.Org View source version on accesswire.Com:https://www.Accesswire.Com/595055/What-Are-The-Main-Benefits-Of-Comparing-Car-Insurance-Quotes-Online View photos



picture credit

ExBUlletin

to request, modification Contact us at Here or [email protected]