Trying to set up repo
This commit is contained in:
13
getfromha.py
Normal file
13
getfromha.py
Normal 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`
|
||||
Reference in New Issue
Block a user