Inconsistent tile updates

I’m working on a custom device type that displays information from my solar panels. I’m pulling information from a set of API’s, then just trying to update the tile values to display a few values: current power generation, daily total and weekly total. I’ve also got an “error message” tile in case there are any system faults that are reported. If no faults, then I have the text hard coded to say “No Faults”.

This seems pretty straight forward, but I’m having horribly inconsistent results when running in both the simulator and after publishing to myself and running on my iPhone.

My “current power” tile seems to be working fine and even changes color depending on the current power output:

		valueTile("power", "device.power", width: 2, height: 2) {
    		state("power", label:'${currentValue}', unit:"W",
        		backgroundColors:[    
            		[value: 10, color: "#868686"],
            		[value: 200, color: "#e5e500"],
            		[value: 400, color: "#79b821"]
 		       ]
    		)
    	}

It is being updated by this:
sendEvent(name: "power", value: SolarSummary.current_power, label: SolarSummary.current_power, unit: "W")

My other tiles are having a horrible time with getting consistent results. It seems to change each update I make, but currently, my weekly total is getting updated perfectly, but the today and alert tile don’t ever show any data. Previously, the today was getting updated but nothing else was. On one iteration, the alertmsg was getting populated. And, if I look at the “Activity” log, it shows that all 4 “value” are getting updated properly with each refresh.

        valueTile("week", "device.week") {
          state "default", label:'${currentValue} kWh', unit: "kWh"
        }
        valueTile("today", "device.today") { 
          state "default", label:'${currentValue} kWh', unit: "kWh"
        }
        valueTile("alertmsg", "device.alertmsg", decoration: "flat", height: 1, width: 2) {
          state "default", label:'${currentValue}'
        }
//Being updated by this:
        sendEvent(name: "week", value: SolarSummary.energy_week/1000 as String, label: SolarSummary.energy_week/1000 as String, unit: "kWh")
        sendEvent(name: "today", value: SolarSummary.energy_today/1000 as String, label: SolarSummary.energy_today/1000 as String, unit: "kWh")

        sendEvent(name: "alertmsg", value: "No Faults", label: "No Faults")

Here is a recent log:
ID Date Source Type Name Value Displayed Text Displayed State Change
ea17ed7f-81e2-4868-9832-046092778ebd 20 Jan 2014 19:29:46 - 4 hours ago DEVICE alertmsg No Faults Solar Panels alertmsg is No Faults true true
714ac5fb-468d-437a-925f-c0eea6b444ef 20 Jan 2014 19:29:46 - 4 hours ago DEVICE today 2.706 Solar Panels today is 2.706 kWh true true
38b5a0e4-7f5c-4d71-abbb-fb8196273841 20 Jan 2014 19:29:45 - 4 hours ago DEVICE week 53.175 Solar Panels week is 53.175 kWh true true
185fed2b-d7d6-4a13-a1b8-ab8582cf526b 20 Jan 2014 19:29:45 - 4 hours ago DEVICE power 483 Solar Panels power is 483 W true true

Any suggestions or direction is appreciated

Be sure to tap uninstall in the simulator and then publish. On the phone go all the way out of ST and then back in. Usually this clears it up.

I had a case in the past where I had a device instance left running by the simulator. Made for very weird intermittent results.

HTH,
Twack

In the simulator, I usually just do the update…I’ll do the uninstall/install go-forward. On the iPhone, I’ve been deleting the device (from the web), then re-adding. I typically do close the app complete and re-launch.

Just do the uninstall in the IDE when your ready to deploy. I’ve never had to delete the device on the phone before. Just getting out and going back in usually did the trick.

I found the main issue with my device. I am using my own ‘custom’ tiles, which I guess translate to capabilities. But, I had not defined the items as custom capabilities in the device settings. Once I addd “today”, “week” and “alertmsg” as custom attributes or capabilities, my app is now functioning very well on the iPhone. Clearly the simulator takes a lot of liberties. My “power” tile was working because power is an inherent capability.

Now to figure out why my input enumeration isn’t working.

1 Like