Becoming a more powerful power user, with GPT

I've been playing with home automation for nearly a decade. "Systems integration as a hobby," I call it. Recently I've taken the capabilities of my home's automation system (Underpinned by Home Assistant) up a level, with the help of ChatGPT. I think it's a great case study in making simple coding tasks more accessible to technical people who are technically not developers.
### Solving Real Problems with GPT Assistance
Given my background of an engineer, I'm comfortable navigating the intricacies of technical architectures, and using these to make products and experiences. Having said that, I've not been the world's fastest coder. I think a big part of it is inertia. I've done simple things in many languages (Python, Excel and M Formulas, MatLab, Apple Script!!, Java, MS DOS batch files, and whatever my ancient SHARP Scientific calculator ran...for starters) I've usually not needed to do them frequently or consistently enough to be able to write code at the speed my brain goes. For personal projects, I've usually either found another way (bless my hacker heart), or gone without.
Enter GPT.
A recent example: I decided I wanted a dehumidifier to operate based on the avererage humidity of two rooms. I described what I wanted to GPT:
Ryan:
Create a template sensor that combines 2 humidity sensors, as long as a new reading has been provided from at both sensors in the last hour
GPT responded with code, and even explained llimitations of the approach:
GPT:
- Combines the sensors if both have updated in the last hour (
<= 1
hours).- Otherwise, the state will be
unknown
.
From here I was able to iterate by refining my request:
Ryan:
In cases where one of the sensors hasn’t reported in an hour, can I have it just fall back to the other sensor instead of going unknown?
GPT:
Certainly! You can adjust the Jinja template to fall back to the value of a single sensor if the other hasn’t reported within an hour. Here's the updated logic:
The process was iterative, rewarding, and educational since each tweak taught me a little more about how the underlying code worked.
Not every experience has been so seamless. I also recently turned to ChatGPT for help in setting up a software package go2rtc. In this instance, ChatGPT kept insisting that I could do something a certain way despite this not being found in the documentation. I was experiencing one of the infamous halucinations. Nevertheless, I'm excited to see how else this tool helps me prototype and realize my own ideas and concepts.