The following should work
add a new command to your DH
command "removeVariable"
then add the following method
def removeVariable(){
state.remove('name of variable')
}
The following should work
add a new command to your DH
command "removeVariable"
then add the following method
def removeVariable(){
state.remove('name of variable')
}
Thanks for this.
Useful if you change a state variable name in an update and want to remove the old one.
Andy
So I added the lines of code to the Driver (see below) and when I select 'Remove Variable' I still receive the prior state.
/**
*
* Based on Brian Steere's original Code
*
*/
metadata {
definition (name: "Netatmo Rain", namespace: "fuzzysb", author: "Stuart Buchanan") {
capability "Sensor"
capability "Battery"
capability "Refresh"
attribute "rain", "number"
attribute "precip_1hr", "number"
attribute "precip_today", "number"
attribute "units", "string"
attribute "lastupdate", "string"
command "poll"
command "removeVariable"
}
preferences {
input title: "Settings", description: "To change units and time format, go to the Netatmo Connect App", displayDuringSetup: false, type: "paragraph", element: "paragraph"
input title: "Information", description: "Your Netatmo station updates the Netatmo servers approximately every 10 minutes. The Netatmo Connect app polls these servers every 5 minutes. If the time of last update is equal to or less than 10 minutes, pressing the refresh button will have no effect", displayDuringSetup: false, type: "paragraph", element: "paragraph"
}
}
// parse events into attributes
def parse(String description) {
log.debug "Parsing '${description}'"
}
def poll() {
log.debug "Polling"
parent.poll()
}
def removeVariable() {
state.remove('precip_1hr')
}
def refresh() {
log.debug "Refreshing"
parent.poll()
}
I use it to remove state shown here.. Refresh the page after you hit the button.
I would be careful using this. It crashed my db if I try to delete a state variables that is not there. @mike.maxwell is this something that should be avoided somehow during the state.remove call?
Sure: if (state.whatevs) bla bla bla...
Yes, thank you.
So I know this one is on me, but maybe I can get help here.
I changed the app to recognize the attribute for rainSumHour as opposed to precip_1hr.
The goal is to turn on some lights when it rains in my backyard.
Anyway. It rained today and the trigger did not fire
Unless I know exactly what changes you made I cannot help.
You will also need to keep live logging open and see what errors (if any) are produced.
The logs you show here appear to be from your netatmo driver, not the app
It is difficult to support code that I know nothing about!
Why don’t you just let me have a copy of the driver that you are using and I’ll see if I can add the correct attribute?
That way, when I update weather switch you will not have to change code each time you update.
Andy
/**
*
* Based on Brian Steere's original Code
*
*/
metadata {
definition (name: "Netatmo Rain", namespace: "fuzzysb", author: "Stuart Buchanan") {
capability "Sensor"
capability "Battery"
capability "Refresh"
attribute "rain", "number"
attribute "rainSumHour", "number"
attribute "rainSumDay", "number"
attribute "units", "string"
attribute "lastupdate", "string"
command "poll"
command "removeVariable"
}
preferences {
input title: "Settings", description: "To change units and time format, go to the Netatmo Connect App", displayDuringSetup: false, type: "paragraph", element: "paragraph"
input title: "Information", description: "Your Netatmo station updates the Netatmo servers approximately every 10 minutes. The Netatmo Connect app polls these servers every 5 minutes. If the time of last update is equal to or less than 10 minutes, pressing the refresh button will have no effect", displayDuringSetup: false, type: "paragraph", element: "paragraph"
}
}
// parse events into attributes
def parse(String description) {
log.debug "Parsing '${description}'"
/**
*
* Based on Brian Steere's original Code
*
*/
metadata {
definition (name: "Netatmo Wind", namespace: "fuzzysb", author: "Stuart Buchanan") {
capability "Sensor"
capability "Battery"
capability "Refresh"
attribute "WindStrength", "number"
attribute "WindAngle", "number"
attribute "GustStrength", "number"
attribute "GustAngle", "number"
attribute "max_wind_str", "number"
attribute "units", "string"
attribute "lastupdate", "string"
attribute "date_max_wind_str", "string"
command "poll"
}
preferences {
input title: "Settings", description: "To change units and time format, go to the Netatmo Connect App", displayDuringSetup: false, type: "paragraph", element: "paragraph"
input title: "Information", description: "Your Netatmo station updates the Netatmo servers approximately every 10 minutes. The Netatmo Connect app polls these servers every 5 minutes. If the time of last update is equal to or less than 10 minutes, pressing the refresh button will have no effect", displayDuringSetup: false, type: "paragraph", element: "paragraph"
}
@JDogg016
These two post only look to be half of each driver
There looks to be a lot of code missing
Andy
/**
* Netatmo Connect
*/
import java.text.DecimalFormat
import groovy.json.JsonSlurper
private getApiUrl() { "https://api.netatmo.com" }
private getVendorName() { "netatmo" }
private getVendorAuthPath() { "/oauth2/authorize" }
private getVendorTokenPath(){ "${apiUrl}/oauth2/token" }
private getVendorIcon() { "https://s3.amazonaws.com/smartapp-icons/Partner/netamo-icon-1%402x.png" }
private getClientId() { settings.clientId }
private getClientSecret() { settings.clientSecret }
//private getClientId() { app.id }
//private getClientSecret() { state.accessToken }
private getCallbackUrl() { getServerUrl()+ "/oauth/callback?access_token=${state.accessToken}" }
private getBuildRedirectUrl() { getServerUrl() + "/oauth/initialize?access_token=${state.accessToken}" }
private getServerUrl() { return getFullApiServerUrl() }
// Automatically generated. Make future change here.
definition(
name: "Netatmo (Connect)",
namespace: "fuzzysb",
author: "Stuart Buchanan",
description: "Netatmo Integration",
category: "Weather",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/netamo-icon-1.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/netamo-icon-1%402x.png",
oauth: true,
singleInstance: true
Setting up weewx seems to be a bit of an overkill in order to simply turn on a series of lights when it rains.
@Cobra - do you think I have provided you everything?
I’m sorry Justin no.
The driver code you posted is not complete.
I don’t need the connect app, just the full driver code
Once I have the code
I would expect it to be quite easy to adapt to the correct output attributes.
Andy
Rain Device
/**
*
* Based on Brian Steere's original Code
*
*/
metadata {
definition (name: "Netatmo Rain", namespace: "fuzzysb", author: "Stuart Buchanan") {
capability "Sensor"
capability "Battery"
capability "Refresh"
attribute "rain", "number"
attribute "rainSumHour", "number"
attribute "rainSumDay", "number"
attribute "units", "string"
attribute "lastupdate", "string"
command "poll"
}
preferences {
input title: "Settings", description: "To change units and time format, go to the Netatmo Connect App", displayDuringSetup: false, type: "paragraph", element: "paragraph"
input title: "Information", description: "Your Netatmo station updates the Netatmo servers approximately every 10 minutes. The Netatmo Connect app polls these servers every 5 minutes. If the time of last update is equal to or less than 10 minutes, pressing the refresh button will have no effect", displayDuringSetup: false, type: "paragraph", element: "paragraph"
}
}
// parse events into attributes
def parse(String description) {
log.debug "Parsing '${description}'"
}
def poll() {
log.debug "Polling"
parent.poll()
}
def refresh() {
log.debug "Refreshing"
parent.poll()
}
Wind Device
/**
*
* Based on Brian Steere's original Code
*
*/
metadata {
definition (name: "Netatmo Wind", namespace: "fuzzysb", author: "Stuart Buchanan") {
capability "Sensor"
capability "Battery"
capability "Refresh"
attribute "WindStrength", "number"
attribute "WindAngle", "number"
attribute "GustStrength", "number"
attribute "GustAngle", "number"
attribute "max_wind_str", "number"
attribute "units", "string"
attribute "lastupdate", "string"
attribute "date_max_wind_str", "string"
command "poll"
}
preferences {
input title: "Settings", description: "To change units and time format, go to the Netatmo Connect App", displayDuringSetup: false, type: "paragraph", element: "paragraph"
input title: "Information", description: "Your Netatmo station updates the Netatmo servers approximately every 10 minutes. The Netatmo Connect app polls these servers every 5 minutes. If the time of last update is equal to or less than 10 minutes, pressing the refresh button will have no effect", displayDuringSetup: false, type: "paragraph", element: "paragraph"
}
}
// parse events into attributes
def parse(String description) {
log.debug "Parsing '${description}'"
}
def poll() {
log.debug "Polling"
parent.poll()
}
def refresh() {
log.debug "Refreshing"
parent.poll()
}
Outdoor Device
/**
*
* Based on Brian Steere's original Code
*
*/
metadata {
definition (name: "Netatmo Outdoor Module", namespace: "fuzzysb", author: "Stuart Buchanan") {
capability "Relative Humidity Measurement"
capability "Temperature Measurement"
capability "Sensor"
capability "Battery"
capability "Refresh"
capability "Thermostat"
attribute "min_temp", "number"
attribute "max_temp", "number"
attribute "temp_trend", "string"
attribute "lastupdate", "string"
}
preferences {
input title: "Settings", description: "To change units and time format, go to the Netatmo Connect App", displayDuringSetup: false, type: "paragraph", element: "paragraph"
input title: "Information", description: "Your Netatmo station updates the Netatmo servers approximately every 10 minutes. The Netatmo Connect app polls these servers every 5 minutes. If the time of last update is equal to or less than 10 minutes, pressing the refresh button will have no effect", displayDuringSetup: false, type: "paragraph", element: "paragraph"
}
}
// parse events into attributes
def parse(String description) {
log.debug "Parsing '${description}'"
}
def poll() {
log.debug "Polling"
parent.poll()
}
def refresh() {
log.debug "Refreshing"
parent.poll()
}
My apologies as I did not realize the full code of the drivers did not paste over.
Justin
Can you do me a favour?
I need to see the log of one of the devices when the device sends data to the driver
What I am looking for is when the device reports to hubitat
I need to see the ‘parse’ logging
Probably a ‘poll’ or ‘refresh’ would make the device report
Andy
I lied, can I have a full copy if the connact app too please?
Andy