i have changed tile from the attribute to switch and the css worked fine. running and stopped. but the problem is that i can toggle the state of the switch which i am trying to avoid. is there a way to disable the ability to toggle the tile
Technically yes, but not in a nice way. You could place a tile over the top. I probably don't have time to explain it, but I am thinking a text tile with no text, a transparent background and a z-index higher than the switch tile. Some can be achieved through the regular UI, the z-index needs to be done via some CSS (or using my editor if you want to install it).
Here's an exmaple of the z-index:
#tile-70 {z-index: 999; !important;}
Personally I'm leaning back towards @aaiyar 's suggestion, but I expect that could be achieved using a Hub Variable and an RM rule, rather than needing to write a driver. The Hub Variable should then be able to be added to the dashboard and display the value.
See how you go, but I can't do anything meaningful until later this evening for me.
The css trick is nice, the Virtual driver would be my method as css customizations don't port via api but do work with HE dashboards...
images of words... I wonder (and never tried it yet) if you could make a device icon that has the word you want - like a png for on and png for off. I think I used a trick similarly once when I wanted Alexa virtual switches to show on my android dashboard. I also used the trick for my battery manager app...
Yeah, css for attribute is very tricky. There are way too many layers for the content. Being a noob, I can't remember how many hours spent on trying to get something to work.
I know you have a satisfactory solution, but this is what I meant by using a custom driver and the attribute template tile in Dashboard. In this case, I modified @ogiewon's "Virtual Presence with Switch" driver, such that turning the switch on/off sets a custom attribute called "runStatus" to RUNNING/FAULT.
You would need to setup an automation to turn this switch on/off based on your thermostat status (simple to do in Basic Rule). And then here's what the Dashboard tile would look like:
Here's the driver:
Virtual Run Status with Switch
/*
* Virtual Run Status with Switch
*
*
* Copyright 2018 Daniel Ogorchock
*
* 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
* ---- --- ----
* 2018-08-04 Dan Ogorchock Original Creation
* 2018-11-18 Dan Ogorchock Added arrived() and departed() custom commands
* 2022-05-01 Ashok Aiyar Modified @ogiewon's driver for a custom attribute tile
*
*/
metadata {
definition (name: "Virtual Run Status with Switch", namespace: "ogiewon", author: "Daniel Ogorchock") {
capability "Actuator"
capability "Switch"
attribute "runStatus","string"
command "running"
command "fault"
}
}
def running() {
on()
}
def fault() {
off()
}
def on() {
sendEvent(name: "runStatus", value: "RUNNING")
sendEvent(name: "switch", value: "on")
}
def off() {
sendEvent(name: "runStatus", value: "FAULT")
sendEvent(name: "switch", value: "off")
}
def installed() {
}
I will give it a try. I will let you know how it come out. Can I still use css to change the color of the tile like what i have done in switch?
this is the sample of my dashboard status tiles.
I could not get it better than that. i wish I can change the whole background color to red instead of just the word without changing the switch template back ground or else all switched will be red when they are turned. i want to be able to change back ground to specific tile when needed. do you know how to do that?
Yeah, the templates (I expect) only have a limited set of settings you can ovveride, so they weren't an option for the text, but colours they can be used for. A much better solution than what I was going to suggest....
The custom colors are for any tile that uses that template (attribute in this case).
If you don't want all attribute tiles with the state value to be formatted that way, then you may need to revert to my option of a switch tils overlayed by the attribute tile and some css, or hopefully someone else comes up with a better idea...
I haven't ventured into very complicated dashboards as of yet...but just wondering if this couldn't be handled the way I had to invert the status of a hacked contact sensor (attached to a current sensor) for notification clarity?
I created a string variable which was loaded with "PUMP ON" when the contact was CLOSED and "PUMP OFF" when the contact was OPEN. When the notification comes upon a state change nobody has to think
I'm probably looking at the problem too simply or not realizing the scope what can drive a button on the dashboard.