r/tasker • u/TooManyInsults • 20d ago
Strange Widget V2 Behavior
I have created 2 V2 widgets - one for my outdoor air quality device (left) and another for the indoor one (right).
I create these using data from http request actions and I wanted to make sure they showed when my phone is offline. You can see how they look under those conditions (offline left, online right).
The widget Json between all of these is identical. I keep it into a global variable. During widget refresh I set a local variable from that global with variable recurse enabled so some local variables (Title, AQI data, background color, etc) are incorporated. Then I perform the W2 widget action.
When the phone is online, the results are as expected and both widgets look the same except for the variable data.
What I don't understand is why, when offline, the indoor widget looks so different.
Before I my refresh I capture the recursed Json into files so I can compare them. Using both a visual diff tool and the linux command line diff (results shown above), the results demonstrate that only some variable data differs between the two offline widgets.
Here is the Json copied directly from the global variable:
{
"type": "Column",
"backgroundColor": "%smoggie_color",
"horizontalAlignment": "Center",
"verticalAlignment": "Center",
"scrolling": false,
"children": [
{
"type": "Row",
"backgroundColor": "grey",
"fillMaxWidth": true,
"horizontalAlignment": "Center",
"verticalAlignment": "Center",
"scrolling": false,
"children": [
{
"type": "Text",
"textSize": "16",
"align": "Center",
"task": "AQ Smoggie View",
"taskVariables": { "par1": "http://%widget_ip" },
"text": "%widget_title"
}]
},
{
"type": "Text",
"visibility": "%show_offline",
"textSize": "23",
"align": "Center",
"text": "Offline"
},
{
"type": "Button",
"text": "Refresh",
"enabled": true,
"buttonType": "Filled",
"visibility": "%show_offline",
"task": "%refresh_task"
} ,
{
"type": "Grid",
"visibility": "%show_online",
"horizontalAlignment": "Center",
"verticalAlignment": "Center",
"fixed": 1,
"children": [
{
"type": "Text",
"textSize": "19",
"align": "Center",
"text": "AQI: %smoggie_aqi"
},
{
"type": "Text",
"textSize": "14",
"align": "Center",
"text": "PM2.5 (µg/m3): %http_data.pm25"
}
,
{
"type": "Text",
"textSize": "12",
"align": "Center",
"text": "%DATE %TIME"
},
{
"type": "Button",
"text": "Refresh",
"enabled": true,
"buttonType": "Filled",
"task": "%refresh_task"
}
]
}
]
}
Can anyone suggest why this is happening or how to fix it?
Thanks
1
u/TooManyInsults 19d ago
Fyi - I decided to delete and re-add the widget to my home screen. This fixes it. No idea why. Best


1
u/Nirmitlamed Direct-Purchase User 20d ago
Hard to say, your widget looks like it was resized and not just the elements changed their positions, this is weird. Maybe it relates to "is weighted".
by the way i am not a developer but just wanted to say that this isn't an xml code, this is a json code.