Custom widget to show temperature

So I’ve been playing around with Tasker this weekend setting up some widgets for my lights, and would like to make one that reports the temperature of a multi-sense. I’ve spent hours looking, but I can’t seem to get the temperature into a widget using Minimilistic Text, Zooper, or Zoom. I have to be screwing something up passing the info along. I’ve followed 3 or 4 examples on how to do this, so I’m guessing it’s something small. Any chance someone could lend a hand on this?

Here’s some instructions on doing this with Minimalistic Text. From our email discussions, you are using SharpTools, so these instructions are based around that.

  1. Open SharpTools, long press on the multi sensor, and subscribe to the temperature attribute
  2. In Tasker, create an event profile using Plugin > SharpTools > Thing State
  3. Configure the Thing State plugin with your device name and temperature attribute
  4. Add an action that updates a widget (Minimalistic Text, Zooper, Zoom) with the %st_attr_value

Note that the last step takes the temperature value as a variable from the Thing State event being triggered (by the subscribed temperature value changing) and updates the widget with that value.

And here’s some details on setting it up with Minimalistic Text:

  1. Add a Minimalistic Text widget to your home screen (typically done via a long press on your home screen or opening your app drawer and selecting widgets)
  2. Select a default layout (I chose the first one, but we are going to edit it, so it doesn’t really matter)
  3. Swipe over to Layout, hit the three dot menu over flow on the first row and delete it, then hit the plus icon at the bottom of the screen
  4. Swipe over to MISC and check the box next to Locale and hit OK at the bottom of the screen
  5. Tap the Locale box in the row layout to configure it. Enter a name for the variable like ‘mytemperature’
  6. Press OK. Make sure you press the Save icon at the top of the screen to save your changes.

Go back to Tasker to finish the configuration of the profile from above:

  1. In your Task, add a Minimalistic Text action and hit the pencil icon to configure it
  2. In the first field, enter ‘mytemperature’ for the variable name and enter %st_attr_value for the value field. Then press OK to save your configuration.
  3. Press back until you have fully backed out of Tasker which will save your changes and activate the profile.

PS. I’m on my mobile, so please excuse any typos and the lack of formatting.

So now I can pass text from Taskers MT plug in, but I can’t get the actualtemp to appear. I can change the text in the Variable content, and it changes on the widget, but when I use %st_attr_value, that’s exactly what appears, not the actual temp. I’m also still having issues finding how to make the widget update with anything besides using time and selecting every 14 minutes. I’d like it to update whenever the temp changes. SOOOO close…

SUCCESS!!! Well, sort of. I created a task using Plugin > SharpTools >Get Attribute, then used the Minimalistic plugin to pass the attribute to the widget. Now I just need to figure out the bit of getting the widget to update when the temp changes.

Awesome - I am glad to hear you are making progress!

There are two different approaches to triggering the updates to your widget:

  1. Event Driven (eg. Thing State changing)
  • Event Profile > Thing State: this will react to the state change of a subscribed attribute
  • ‘Thing State’ is a profile/context in Tasker which triggers a set of actions
  1. Time / Other Context (eg. Every 15 minutes requesting the current status)
  • Action > Thing: Get Attribute: this tells SharpTools to go out and ask SmartThings for the current attribute value
  • ‘Thing: Get Attribute’ is an action which runs inside a triggered profile

Note that the event driven approach will only update the widget when an event actually occurs. So if you follow the steps I listed above and manually run the task, you will see the raw %st_attr_value show up in the widget since the push-event was not triggered. As soon as the temperature changes, the Tasker profile should be triggered and your actions will run which will update the widget with the changed value.

Also note that temperature values sometimes change as infrequently as once every few hours depending on the device type (sensitivity) and how much the temperature is changing where the sensor is. So if you follow the steps above, you may have to wait a few hours for the first widget update.

Here’s a video I put together showing the steps mentioned above end-to-end. This is using the event driven approach, so it will update the widget automatically whenever the thing’s state changes:

Thanks for the great video. Made the execution of my widget for a Smartthings temperature sensor a much simpler task.

What i am wondering is if there any way, using Minimalist or another widget engine, to have the text of the temperature value appear in a different color, depending on the temperature shown. If you or anyone could shed light on that, I would appreciate it. Thanks.

That would depend on the widget engine you’re using. I haven’t used Minimalistic Text in a while, but I fired it up and I see how you can change the style, but not how to apply it dynamically.

You might be able to do it with some tricky formatting. Like have two variables displayed in Minimalistic Text with each one styled as your target styles then choose which variable you assign data to and which one you clear.

There might also be better widgets out there, but I’m not familiar with them. There’s lots of other popular widget tools like KWGT, UCCW, Zooper, and more. You might poke around those or ask on the /r/Tasker community as your question is really more about making a widget style change based on Tasker variables (rather than something specific to SharpTools).

One additional question, if I may:

Is SharpTools passive, as regards any sensor event it is tracking, i.e., does it have no impact on the sensor battery through interrogating the sensor?

Thanks.

Yes, it is completely passive to the physical sensor. The event driven approach just listens for events and forwards them to your phone. It’s not actually interrogating the sensor (or even the SmartThings platform).

It’s just telling the SmartThings platform that it wants to subscribe to a certain attribute on the sensor so when an event happens on the sensor that SmartThings should forward it on to the SharpTools mobile app.

Another thing I just noticed while authorizing Sharp Tools on my Samsung Multisensor is that although the Samsung also includes a vibration sensor, it does not appear on the Sharp Tools list of items that can be authorized. Is this a bug?

Thanks.

P. S. Do you have any other blogs for Sharp Tools besides this thread I discovered? Thanks.

When you authorize a device under any one of it’s capabilities, you get access to all of the attributes and commands it exposes.

You can also authorize a device even if it doesn’t match one of the categories on the list as long as it implements at least Sensor or Actuator as shown in this post:

The SharpTools knowledge base may be helpful to you:

https://help.sharptools.io/portal/kb/sharptools/android

And the SharpTools community is a good place to ask questions: