You 🧑
Lets make a new skill to get data from the temp/humidy sensor network in the house. We have 5 locations that run ESP8266 units, with micropython and BME280 sensors. All that stuff works fine, and they run a web server that can return a json packet with the temp/humity for the different locations. Here's the location list devices = [
{"location": "Office", "url": "http://10.0.23.41"},
{"location": "Basement", "url": "http://10.0.23.40"},
{"location": "Wood Room", "url": "http://10.0.23.45"},
{"location": "Outside", "url": "http://10.0.23.44"},
{"location": "Garage", "url": "http://10.0.23.43"},
{"location": "Bedroom", "url": "http://10.0.23.42"}
]
Create a skill with a python script that can just grab them all at once so questions like "What's the hottest part of the house right now?" or "What's the humidity in the wood room?"
▶ Tool: read_file [path='~/Personal/skills/skill_index.md']
▶ Tool: directory_tree [path='~/Personal/skills/weather']
▶ Tool: read_file [path='~/Personal/skills/weather/weather_skill.md']
▶ Tool: read_file [path='~/Personal/skills/weather/get_weather_by_location.py']
▶ Tool: run_bash [command='mkdir -p ~/Personal/skills/sensors']
▶ Tool: write_file [content='#!/usr/bin/env python3\n"""Fetch temperature & hum]…
▶ Tool: run_bash [command='chmod +x ~/Personal/skills/sensors/get_sensor_data]…
▶ Tool: write_file [content='# Sensors Skill\n\nFetches temperature & humidity ]…
▶ Tool: replace_in_file [new_str='| sensors/ | Fetch temperature & humidity from hou]…
▶ Tool: run_bash [command='cd ~/Personal/skills/sensors && python3 -c "import]…
▶ Tool: directory_tree [path='~/Personal/skills/sensors']
▶ Tool: read_file [path='~/Personal/skills/skill_index.md']
Assistant 🤖
Done! Here's what was created:
|
File |
Description |
|
get_sensor_data.py |
Python script that hits all 6 ESP8266 units, parses JSON, and returns structured data |
|
sensors_skill.md |
Skill description with usage, location table, output format, and examples |
All sensors at once:
python get_sensor_data.py --pretty
Returns JSON with a sensors array (each with temperature_c, humidity_pct, ok status) plus a summary block with hottest/coldest/most-humid/driest.
Single location:
python get_sensor_data.py "Wood Room"
# or partial match
python get_sensor_data.py wood
The script handles: - Connection failures gracefully (marks ok: false with an error message instead of crashing) - Multiple common JSON key names (temperature/temp/t, humidity/humid/h) - 5-second timeout per device so one dead unit doesn't hang everything - Small 100ms gap between fetches to avoid flooding the network
Now when you ask "What's the hottest part of the house right now?" or "What's the humidity in the wood room?", I'll use the sensors/ skill to call the script and get live readings! 🏠🌡️
You 🧑
Ok awesome run the skill and tell me what part of the house is the hottest, coldest and most humid!
▶ Tool: run_bash [command='cd ~/Personal/skills/sensors && python3 get_sensor]…
▶ Tool: replace_in_file [new_str=' temp = data.get("temperature") or data.get]…
▶ Tool: replace_in_file [new_str=' temp_keys = ["temperature", "temp", "t", "]…
▶ Tool: run_bash [command='cd ~/Personal/skills/sensors && python3 get_sensor]…
Assistant 🤖
Here are the live readings from your house! 🌡️
Makes sense for a late May day!
Consistently the coolest spot in the house.
Either raining or very damp out there.
Your office is the aridest spot in the house.
|
Location |
Temp |
Humidity |
|
🌳 Outside |
22.0°C 🔥 |
100.0% 💧 |
|
🏢 Office |
20.9°C |
33.6% 🏜️ |
|
🚗 Garage |
19.6°C |
42.9% |
|
🛏️ Bedroom |
19.2°C |
43.3% |
|
🪵 Wood Room |
16.6°C |
47.6% |
|
🕳️ Basement |
16.4°C ❄️ |
42.9% |
Also fixed the script — it now properly handles temp_c as a key and won't break if a reading ever hits exactly 0.0°C. Good to go!