I have Enable Event and Status Info Logging disabled and Disable Info logging turned on. That tones down the logging from the app itself. However the devices have some logging in the driver itself that isn't affect by those settings. For example, the presence driver has an info log for every presence event, just logs the descriptionText. Again not a big deal, but not something I care to see every time.
I manually added a preference option to disable those in driver.
/**
* Copyright 2022 Bloodtick
*
* Licensed under 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.
*
*/
@SuppressWarnings('unused')
public static String version() {return "1.2.0"}
metadata
{
definition(name: "Replica Presence", namespace: "replica", author: "bloodtick", importUrl:"https://raw.githubusercontent.com/bloodtick/Hubitat/main/hubiThingsReplica/devices/replicaPresence.groovy")
{
capability "Actuator"
capability "Battery"
capability "Configuration"
capability "PresenceSensor"
capability "Refresh"
attribute "healthStatus", "enum", ["offline", "online"]
}
preferences {
input "infoOutput", "bool", title: "Enable descriptive text logging", defaultValue: true
}
}
def installed() {
initialize()
}
def updated() {
initialize()
}
def initialize() {
updateDataValue("triggers", groovy.json.JsonOutput.toJson(getReplicaTriggers()))
updateDataValue("commands", groovy.json.JsonOutput.toJson(getReplicaCommands()))
}
def configure() {
log.info "${device.displayName} configured default rules"
initialize()
updateDataValue("rules", getReplicaRules())
sendCommand("configure")
}
// Methods documented here will show up in the Replica Command Configuration. These should be mostly setter in nature.
Map getReplicaCommands() {
return ([ "setBatteryValue":[[name:"battery*",type:"NUMBER"]], "setPresenceValue":[[name:"presence*",type:"ENUM"]], "setPresenceNotPresent":[], "setPresencePresent":[], "setHealthStatusValue":[[name:"healthStatus*",type:"ENUM"]]])
}
def setBatteryValue(value) {
String descriptionText = "${device.displayName} battery level is $value %"
sendEvent(name: "battery", value: value, unit: "%", descriptionText: descriptionText)
if (infoOutput) log.info descriptionText
}
def setPresenceValue(value) {
String descriptionText = "${device.displayName} is $value"
sendEvent(name: "presence", value: value, descriptionText: descriptionText)
if (infoOutput) log.info descriptionText
}
def setPresenceNotPresent() {
setPresenceValue("not present")
}
def setPresencePresent() {
setPresenceValue("present")
}
def setHealthStatusValue(value) {
sendEvent(name: "healthStatus", value: value, descriptionText: "${device.displayName} healthStatus set to $value")
}
// Methods documented here will show up in the Replica Trigger Configuration. These should be all of the native capability commands
Map getReplicaTriggers() {
return ([ "refresh":[]])
}
private def sendCommand(String name, def value=null, String unit=null, data=[:]) {
parent?.deviceTriggerHandler(device, [name:name, value:value, unit:unit, data:data, now:now])
}
void refresh() {
sendCommand("refresh")
}
String getReplicaRules() {
return """{"version":1,"components":[{"trigger":{"type":"attribute","properties":{"value":{"title":"HealthState","type":"string"}},"additionalProperties":false,"required":["value"],"capability":"healthCheck","attribute":"healthStatus","label":"attribute: healthStatus.*"},"command":{"name":"setHealthStatusValue","label":"command: setHealthStatusValue(healthStatus*)","type":"command","parameters":[{"name":"healthStatus*","type":"ENUM"}]},"type":"smartTrigger","mute":true},{"trigger":{"type":"attribute","properties":{"value":{"title":"PresenceState","type":"string"}},"additionalProperties":false,"required":["value"],"capability":"presenceSensor","attribute":"presence","label":"attribute: presence.*"},"command":{"name":"setPresenceValue","label":"command: setPresenceValue(presence*)","type":"command","parameters":[{"name":"presence*","type":"ENUM"}]},"type":"smartTrigger"}]}"""
}