I want to create a notification via Node-RED when Cloud backup fails but I don't see that event being published either through the "event" node or the "location" node. I do see that event under Hub Events in the Logs tab.
Has anyone tried to do something similar or have an alternate solution? I don't use Hubitat rules so hoping that there is something that I can do with Node-RED.
@thebearmay - in thought I had seen a driver that you had created for the Cloud Backup event but I can't find it any longer. Is that something that you still have?
I think that was it. I was hoping that I could simply grab that event in Node-RED but neither of the nodes see it. What I’m hoping now is something that sets a state (success/fail and maybe the text) in a virtual device that I could then get in NR.
Aargh - looks like it won't work as it requires a notification device to be set up in HE . Let me look around and see if I can find another solution. Thanks again for your quick response.
/*
* Notify to Attribute Device
*
* Licensed Virtual the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*
* Change History:
*
* Date Who What
* ---- --- ----
*
*/
static String version() { return '0.0.0' }
metadata {
definition (
name: "Notification Attribute",
namespace: "thebearmay",
description: "Simple driver to act as a destination for notifications, and set an attribute to the value",
author: "Jean P. May, Jr.",
importUrl:"https://raw.githubusercontent.com/thebearmay/hubitat/main/xxx.groovy",
singleThreaded: true
) {
capability "Notification"
capability "Actuator"
attribute "notification", "STRING"
}
}
preferences {
input("debugEnable", "bool", title: "Enable debug logging?")
}
void installed() {
}
void updated(){
if (debugEnable) log.trace "updated()"
if(debugEnable) runIn(1800,logsOff)
}
void configure() {
}
void deviceNotification(notification){
sendEvent(name:"notification", value: "$notification")
}
void logsOff(){
device.updateSetting("debugEnable",[value:"false",type:"bool"])
}
@thebearmay@ritchierich - thanks so much for the sample code. I was able to use the notification drivers along with the Cloud Backup Attribute app and see the event in Node-RED.
Then it turned out that I could ALSO see the original backup event in both the event and location nodes! Not sure why it did not work the first time I tried it but it does appear to be working now.