Has anyone found a way to display Global variables on the dashboard ?
I use a virtual driver that has custom attributes which are set by a global variable to show information from Toyota remote connect.
@cwwilson08, which virtual driver did you use?
I'll post it when I get home.
BUMP because I'm interested in this as well.
Shoot sorry guys totally forgot about this. Will post the code when I get home.
For reals this time.
I had started to tailor this for my car. but as it is you can pass in a global variable with a custom action using the gv as the parameter and gvStatus as the command. This can be modified to suit just about whatever you need.
/**
* Copyright 2019 Chris Wilson
*
* Driver to display gv as attribute
*
* 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.
*
*/
metadata {
definition (name: "Virtual Toyota Display Driver", namespace: "cw", author: "cwwilson08", ) {
capability "Actuator"
capability "Sensor"
capability "Switch"
command "gvStatus", ["string"]
attribute "Doors", "string"
attribute "Odometer", "string"
attribute "Gas", "string"
attribute "LastResponse", "string"
}
preferences {}
}
def parse(String description) {
}
def on() {
sendEvent(name: "switch", value: "on", isStateChange: true)
}
def off() {
sendEvent(name: "switch", value: "off", isStateChange: true)
}
def gvStatus(response) {
sendEvent(name: "LastResponse", value: response, isStateChange: true)
if (response.contains("Toyota isn't responding right now. Try again soon")) {log.debug "toyota not responding - insert retry logic here"}
if (response.contains("All the doors are locked in your Camry. Anything else you need")) {log.debug "doors locked"}
if (response.contains("miles before empty")) {sendEvent(name: "Gas", value: response, isStateChange: true) }
if (response.contains("odometer")) {sendEvent(name: "Odometer", value: response, isStateChange: true)}
if (response.contains("All the doors are locked")) {sendEvent(name: "Doors", value: "Locked", isStateChange: true)}
if (response.contains("All the doors are unlocked in your Camry.")) {sendEvent(name: "Doors", value: "Unlocked", isStateChange: true)}
if (response.contains("I am reaching out to your Camry to unlock the doors")) {log.debug "unlock command - logic to check doors here"}
}
def installed() {
on()
}
Did anybody get this to work? I really am not a coder/developer, but @cwwilson08's code looks more complicated than it might need to be based on what much of us really want to happen (Chris, you clearly have additional goals!). I don't care the device type, switch is fine - whatever. Allow it to have a custom attribute, and when a global variable is changed, use a rule to set that global variable into the attribute.
Stay tuned, some exciting things coming soon for viewing and changing GVs on Dashboard.
For community benefit...Connect Global Variables to Dashboards. works fantastic! Simple yet powerful solution.