Trying to set up repo

This commit is contained in:
2026-05-24 21:07:04 +00:00
commit 52cb4a4b46
9 changed files with 181 additions and 0 deletions

13
getfromha.py Normal file
View File

@@ -0,0 +1,13 @@
import os
from homeassistant_api import Client
URL = 'http://homeassistant.local:8123/api' # Example: 'http://homeassistant.local:8123/api'
TOKEN = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhOTFlYjJlNzc0OWI0M2VlODE5ZDE0MzdiNTY3YzcwMyIsImlhdCI6MTc3OTQxMTM5MiwiZXhwIjoyMDk0NzcxMzkyfQ.f2ULah3a1k4veHpcS9iPFMxR-wvKRb1oA5FbWAZyg9k'
# Assigns the Client object to a variable and checks if it's running.
client = Client(URL, TOKEN)
service = client.get_domain("light") # Gets the light service domain from Home Assistant
service.turn_on(entity_id="light.my_living_room_light")
# Triggers the light.turn_on service on the entity `light.my_living_room_light`