<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/i-used-a-local-llm-to-generate-home-assistant-jinja2-templates-and-complex-automations-stopped-feel-ygndcbtwk" -->

---
title: I used a local LLM to generate Home Assistant Jinja2...
description: A homelabbing hobbyist recounts using local LLMs (via llama.cpp) to generate Jinja2/YAML templates for a Home Assistant automation that monitors an AC&#x27;s power...
canonical: https://daily.dev/posts/i-used-a-local-llm-to-generate-home-assistant-jinja2-templates-and-complex-automations-stopped-feel-ygndcbtwk
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: I used a local LLM to generate Home Assistant Jinja2 templates, and complex automations stopped feeling impossible | daily.dev
og:description: A homelabbing hobbyist recounts using local LLMs (via llama.cpp) to generate Jinja2/YAML templates for a Home Assistant automation that monitors an AC&#x27;s power...
og:url: https://daily.dev/posts/i-used-a-local-llm-to-generate-home-assistant-jinja2-templates-and-complex-automations-stopped-feel-ygndcbtwk
og:image: https://api.daily.dev/og/posts/YGNDCBtWK.png
og:image:alt: I used a local LLM to generate Home Assistant Jinja2 templates, and complex automations stopped feeling impossible
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# I used a local LLM to generate Home Assistant Jinja2 templates, and complex automations stopped feeling impossible

**[XDA Developers](https://daily.dev/sources/xda-developers)** · 5 min read · 1 upvotes · 0 comments

## Summary

A homelabbing hobbyist recounts using local LLMs (via llama.cpp) to generate Jinja2/YAML templates for a Home Assistant automation that monitors an AC's power draw through a TP-Link Tapo switch and announces via Amazon Echo Dot. Qwen's output looked polished but was broken with fabricated fields and syntax bugs; switching to Gemma4-E4B and iterating through several rounds eventually produced working code. Even then, the automation's logic was flawed (it would have woken the user at night), requiring a manual redesign into two separate automations. The takeaway is that local LLMs don't make complex automations easy, but they make attempting them feasible by acting as a translation and debugging layer between idea and implementation.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.xda-developers.com/home-assistant-jinja2-templates-automations-stopped-feeling-impossible>

## Questions this post answers

### Can a local LLM correctly generate Home Assistant Jinja2 automation templates on the first try?

Not reliably. Testing with Qwen and Gemma4-E4B through llama.cpp showed both models produced YAML that looked correct at first glance but contained syntax bugs and fabricated field names. Multiple iterations of asking the model to fix errors were needed before a working template for monitoring AC power draw via a TP-Link Tapo switch was produced.

_daily.dev surfaces real-world local LLM workflows for developers automating their own smart home setups._

### Which is better for generating Home Assistant automation code, Qwen or Gemma4-E4B?

Gemma4-E4B performed slightly better than Qwen in one hands-on test, correctly explaining the last_changed device scenario and its edge cases, though its generated code still had core syntax bugs and fabricated field names on the first pass. Qwen's fixes failed to resolve the reported errors, while Gemma improved after a second iteration.

_Developers comparing local LLMs for coding tasks can track these model trade-offs on daily.dev._

## Similar posts on daily.dev

- [Home Assistant's local LLM support outperforms Gemini for Home, and Google knows it](https://daily.dev/posts/home-assistant-s-local-llm-support-outperforms-gemini-for-home-and-google-knows-it-wk2nhcdrt) · XDA Developers · 0 upvotes · 0 comments
- [Local LLMs finally beat cloud AI for coding, automation, and brainstorming — here's which ones I use](https://daily.dev/posts/local-llms-finally-beat-cloud-ai-for-coding-automation-and-brainstorming-here-s-which-ones-i-use-ckbaaxuqu) · XDA Developers · 0 upvotes · 0 comments
- [My local LLM finally understands my house better than Google ever did](https://daily.dev/posts/my-local-llm-finally-understands-my-house-better-than-google-ever-did-obhye107l) · XDA Developers · 0 upvotes · 0 comments
- [I tested my local LLM across 4 different tools, and only one actually unleashed its potential](https://daily.dev/posts/i-tested-my-local-llm-across-4-different-tools-and-only-one-actually-unleashed-its-potential-9tq2fztgl) · XDA Developers · 0 upvotes · 0 comments
- [Local LLMs changed how I use Home Assistant, and now my smart devices actually listen](https://daily.dev/posts/local-llms-changed-how-i-use-home-assistant-and-now-my-smart-devices-actually-listen-ogoi6tcsg) · XDA Developers · 0 upvotes · 0 comments

---

Tags: [#tech-news](https://daily.dev/tags/tech-news), [#local-ai](https://daily.dev/tags/local-ai), [#llama-cpp](https://daily.dev/tags/llama-cpp)

[View this post on daily.dev](https://daily.dev/posts/i-used-a-local-llm-to-generate-home-assistant-jinja2-templates-and-complex-automations-stopped-feel-ygndcbtwk)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"I used a local LLM to generate Home Assistant Jinja2 templates, and complex automations stopped feeling impossible","url":"https://daily.dev/posts/i-used-a-local-llm-to-generate-home-assistant-jinja2-templates-and-complex-automations-stopped-feel-ygndcbtwk","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/i-used-a-local-llm-to-generate-home-assistant-jinja2-templates-and-complex-automations-stopped-feel-ygndcbtwk"},"datePublished":"2026-09-03T14:01:29.840Z","dateModified":"2026-09-03T14:24:58.596Z","description":"A homelabbing hobbyist recounts using local LLMs (via llama.cpp) to generate Jinja2/YAML templates for a Home Assistant automation that monitors an AC's power...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d3220eaab450383d56c5d089efc46aef?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d3220eaab450383d56c5d089efc46aef?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"XDA Developers","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"XDA Developers","logo":"https://media.daily.dev/image/upload/s--kCg6yyAP--/f_auto,q_auto/v1774964407/logos/xda-developers?_a=BAMAMiWQ0","url":"https://daily.dev/sources/xda-developers"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/i-used-a-local-llm-to-generate-home-assistant-jinja2-templates-and-complex-automations-stopped-feel-ygndcbtwk","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"tech-news,local-ai,llama-cpp","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"XDA Developers","item":"https://daily.dev/sources/xda-developers"},{"@type":"ListItem","position":3,"name":"I used a local LLM to generate Home Assistant Jinja2 templates, and complex automations stopped feeling impossible"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/i-used-a-local-llm-to-generate-home-assistant-jinja2-templates-and-complex-automations-stopped-feel-ygndcbtwk#faq","mainEntity":[{"@type":"Question","name":"Can a local LLM correctly generate Home Assistant Jinja2 automation templates on the first try?","acceptedAnswer":{"@type":"Answer","text":"Not reliably. Testing with Qwen and Gemma4-E4B through llama.cpp showed both models produced YAML that looked correct at first glance but contained syntax bugs and fabricated field names. Multiple iterations of asking the model to fix errors were needed before a working template for monitoring AC power draw via a TP-Link Tapo switch was produced. daily.dev surfaces real-world local LLM workflows for developers automating their own smart home setups."}},{"@type":"Question","name":"Which is better for generating Home Assistant automation code, Qwen or Gemma4-E4B?","acceptedAnswer":{"@type":"Answer","text":"Gemma4-E4B performed slightly better than Qwen in one hands-on test, correctly explaining the last_changed device scenario and its edge cases, though its generated code still had core syntax bugs and fabricated field names on the first pass. Qwen's fixes failed to resolve the reported errors, while Gemma improved after a second iteration. Developers comparing local LLMs for coding tasks can track these model trade-offs on daily.dev."}}]}
```

