Need help for a simple android template widget

Hello,

I’m trying to get a very simple template widget on android, without any formatting. Something like :

Office : 26°C
Outside : 30°C

So I created this j2 template which is working in HA :

Which as the end should be :

Office : {{states('sensor.bureau_3')}}
Outside : {{states('sensor.exterieur_3' )}}

But when typing it in the Android Widget I got a “Error in template”:

Am I missing something? The documentation has no example regarding this functionnality.

Thanks!

Check the companion app logs to see the cause of the error.

same for me with:

{{ states.sensor.delta_pro_240327_dc_input.state | int }}W

and it was fine sometime ego

remove the single quotes from the lines
show the logs for more information.

But issue happens during creation android widget from template.
Is there any logs in this case?
same template working file in HA developer tools templates.

Logs from android application:

07-06 20:04:49.140  9466  9466 E TemplateWidget: Unable to render template: <big><strong>{{ states.sensor.delta_pro_240327_dc_input.state | int }}W</strong></big><br>        solar input
07-06 20:04:49.140  9466  9466 E TemplateWidget: java.lang.IllegalArgumentException: No server for ID
07-06 20:04:49.140  9466  9466 E TemplateWidget: 	at io.homeassistant.companion.android.common.data.servers.ServerManagerImpl.integrationRepository(ServerManagerImpl.kt:178)
07-06 20:04:49.140  9466  9466 E TemplateWidget: 	at io.homeassistant.companion.android.widgets.template.TemplateWidget.getWidgetRemoteViews(TemplateWidget.kt:240)
07-06 20:04:49.140  9466  9466 E TemplateWidget: 	at io.homeassistant.companion.android.widgets.template.TemplateWidget.getWidgetRemoteViews$default(TemplateWidget.kt:203)
07-06 20:04:49.140  9466  9466 E TemplateWidget: 	at io.homeassistant.companion.android.widgets.template.TemplateWidget$updateView$1.invokeSuspend(TemplateWidget.kt:198)
07-06 20:04:49.140  9466  9466 E TemplateWidget: 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
07-06 20:04:49.140  9466  9466 E TemplateWidget: 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
07-06 20:04:49.140  9466  9466 E TemplateWidget: 	at android.os.Handler.handleCallback(Handler.java:984)
07-06 20:04:49.140  9466  9466 E TemplateWidget: 	at android.os.Handler.dispatchMessage(Handler.java:104)
07-06 20:04:49.140  9466  9466 E TemplateWidget: 	at android.os.Looper.loopOnce(Looper.java:238)
07-06 20:04:49.140  9466  9466 E TemplateWidget: 	at android.os.Looper.loop(Looper.java:357)
07-06 20:04:49.140  9466  9466 E TemplateWidget: 	at android.app.ActivityThread.main(ActivityThread.java:8118)
07-06 20:04:49.140  9466  9466 E TemplateWidget: 	at java.lang.reflect.Method.invoke(Native Method)
07-06 20:04:49.140  9466  9466 E TemplateWidget: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
07-06 20:04:49.140  9466  9466 E TemplateWidget: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:957)

try testing the template without the app from dev tools > templates

Fixed by dshokouhi suggestion to logout/login android app.
Thanks a lot!

1 Like