Notifications - Text & Sound

You don't need to use Rule Machine; I was just suggesting that as a built-in option you can use to send notifications based on a device it sounds like you already (nearly?) have a driver for.

If you want to send a notification to the Hubitat mobile app device, however, you will need to get an app involved. Rule Machine is just one option. If you're building a custom app, you can include this feature there instead. You need a device reference, as in the input example above, and can call the deviceNotify() command on it. You cannot send a notification to the Hubitat mobile app from your custom driver, at least not directly.

but my final target is to create a notification. So , can I call your device and send a notification ?
if yes, how can I call it from my device ?

No worries.. this can be complicated, and some things should be easier to do then how we actually need to do them, but this is the case with many things we interact with daily.

The issue is that a driver (device) cannot send notifications to other devices. Your phone (if you have the hubitat app installed on it) that you get push notifications on, is another device in Hubitat. So your custom device driver, cannot send a notification to your phone device for it to get the push notification.

That is why we recommended looking at either using an existing app, or writing a custom app which creates child devices. You say 7-8 devices are needed, which could all be children of the single app. Then when any child device needs to send the notification, it will send the notification through the parent app (see example in my earlier post), which can communicate with any device on your system, provided you gave the app access to the notification device similar to my input example earlier in this thread.

I think you will still need an app of some kind (Rule Machine or HSM) to communicate with @kahn-hubitat driver above.

1 Like

ok. I will do that. That's why I asked you if you could provide a very basic app code which would just get one or 2 parameters from user and create a child device based on these.
You already supplied me a code to create child devices. But I don't know how to write a very basic app to get 1-2 parameters and call your "createChildDevice" routine with these.
I'd appreciate if you could tell me that part as well.

I know I have to read more and learn before trying to write my device, but I'm just in a hurry to achieve this. That's why I didn't have time to read and learn.

I dont have any personal code that would easily translate to this, so while trying to keep this less complicated than it needs to be I wont directly link any of my projects. All of my projects started out similar to yours.. I wanted to do something and nothing available would fulfill that specific need. I loaded a bunch of other people's apps and drivers to see how they did things and just started adding to my basic code until it did what I wanted.

This thread is a good primer on the use of Parent/Child code and why/when it is good to use:

They link to the Hubitat github with some examples in the above link, but this app example below should give you the basic structure and allow you to get started:

This should give you a good start, basically start with the averageTemp.groovy and rename it to be your new custom app. Load it in hubitat and go to the app page. Now when you make changes to the code, refresh the app page to see what you did and how it functions. Start to integrate the example code posted above in this thread and post questions when you get stuck.

The notification part is easy once you start playing around with the app code and add the example above. The multiple child devices and settings will take a little bit of playing around to get working. Again, depends on how much programming experience you have along with how much time and motivation you have to work through problems as they arise.

1 Like

thanks. I finally managed to write a simple app as parent of my devices.
and notification works.
I also made the app set IP and Mac address parameters of the child device.
Now everything is easy and smooth.
Besides, I am not running a separate notification app on the hub, which is good.

thanks for all the help !

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.