Fresh start - excluded large ROM JSON files
This commit is contained in:
1
home-assistant/ble_presence.json
Normal file
1
home-assistant/ble_presence.json
Normal file
File diff suppressed because one or more lines are too long
1
home-assistant/brave_results.json
Normal file
1
home-assistant/brave_results.json
Normal file
File diff suppressed because one or more lines are too long
1
home-assistant/brave_wake.json
Normal file
1
home-assistant/brave_wake.json
Normal file
File diff suppressed because one or more lines are too long
3
home-assistant/close-cover.ps1
Normal file
3
home-assistant/close-cover.ps1
Normal file
@@ -0,0 +1,3 @@
|
||||
$token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJmM2QzZWU1NGQyMWI0NGVkYWJmZGE4OGFiMTE3OTQ0MyIsImlhdCI6MTc2OTYxMzM0MiwiZXhwIjoyMDg0OTczMzQyfQ.L5atWZ-zyn-gA7QELxzRXoMnVilyz338hApOuL5MFas"
|
||||
$body = @{entity_id = "cover.door1"} | ConvertTo-Json
|
||||
Invoke-WebRequest -Uri "http://192.168.0.39:8123/api/services/cover/close_cover" -Method Post -Headers @{Authorization="Bearer " + $token} -ContentType "application/json" -Body $body
|
||||
BIN
home-assistant/covers.json
Normal file
BIN
home-assistant/covers.json
Normal file
Binary file not shown.
BIN
home-assistant/door_battery.json
Normal file
BIN
home-assistant/door_battery.json
Normal file
Binary file not shown.
29
home-assistant/get-battery-levels.ps1
Normal file
29
home-assistant/get-battery-levels.ps1
Normal file
@@ -0,0 +1,29 @@
|
||||
$token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJmM2QzZWU1NGQyMWI0NGVkYWJmZGE4OGFiMTE3OTQ0MyIsImlhdCI6MTc2OTYxMzM0MiwiZXhwIjoyMDg0OTczMzQyfQ.L5atWZ-zyn-gA7QELxzRXoMnVilyz338hApOuL5MFas"
|
||||
$baseUrl = "http://192.168.0.39:8123/api/states/"
|
||||
$sensors = @(
|
||||
"sensor.front_door_battery",
|
||||
"sensor.pantry_door_sensor_battery",
|
||||
"sensor.garage_entrance_door_battery",
|
||||
"sensor.office_door_sensor_battery",
|
||||
"sensor.master_closet_door_sensor_battery",
|
||||
"sensor.shower_door_battery",
|
||||
"sensor.hue_motion_sensor_2_battery",
|
||||
"sensor.hue_motion_sensor_3_battery",
|
||||
"sensor.motion_sensor_battery_state",
|
||||
"sensor.pir_battery",
|
||||
"sensor.guest_bath_motion_battery",
|
||||
"sensor.master_bath_motion_battery",
|
||||
"sensor.office_motion_battery",
|
||||
"sensor.master_pooper_battery"
|
||||
)
|
||||
|
||||
foreach ($sensor in $sensors) {
|
||||
try {
|
||||
$r = Invoke-WebRequest -Uri ($baseUrl + $sensor) -Headers @{Authorization="Bearer " + $token} -TimeoutSec 3
|
||||
$s = $r.Content | ConvertFrom-Json
|
||||
$unit = if ($s.attributes.unit_of_measurement) { $s.attributes.unit_of_measurement } else { "-" }
|
||||
Write-Host "$($sensor): $($s.state) $unit"
|
||||
} catch {
|
||||
Write-Host "$sensor - ERROR"
|
||||
}
|
||||
}
|
||||
BIN
home-assistant/ha_states.json
Normal file
BIN
home-assistant/ha_states.json
Normal file
Binary file not shown.
3
home-assistant/list-covers.ps1
Normal file
3
home-assistant/list-covers.ps1
Normal file
@@ -0,0 +1,3 @@
|
||||
$data = Get-Content covers.json -Raw | ConvertFrom-Json
|
||||
$covers = $data | Where-Object { $_.entity_id -match '^cover\.' }
|
||||
$covers | ForEach-Object { $_.entity_id }
|
||||
3
home-assistant/list-sensors.ps1
Normal file
3
home-assistant/list-sensors.ps1
Normal file
@@ -0,0 +1,3 @@
|
||||
$data = Get-Content ha_states.json -Raw | ConvertFrom-Json
|
||||
$sensors = $data | Where-Object { $_.entity_id -match '^sensor\.' }
|
||||
$sensors | ForEach-Object { $_.entity_id }
|
||||
3
home-assistant/open-garage.ps1
Normal file
3
home-assistant/open-garage.ps1
Normal file
@@ -0,0 +1,3 @@
|
||||
$token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJmM2QzZWU1NGQyMWI0NGVkYWJmZGE4OGFiMTE3OTQ0MyIsImlhdCI6MTc2OTYxMzM0MiwiZXhwIjoyMDg0OTczMzQyfQ.L5atWZ-zyn-gA7QELxzRXoMnVilyz338hApOuL5MFas"
|
||||
$body = @{entity_id = "cover.garage_door"} | ConvertTo-Json
|
||||
Invoke-WebRequest -Uri "http://192.168.0.39:8123/api/services/cover/open_cover" -Method Post -Headers @{Authorization="Bearer " + $token} -ContentType "application/json" -Body $body
|
||||
93
home-assistant/openwakeword-mqtt.py
Normal file
93
home-assistant/openwakeword-mqtt.py
Normal file
@@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
openWakeWord to MQTT publisher
|
||||
Publishes wake word detections to Home Assistant MQTT broker
|
||||
"""
|
||||
|
||||
import time
|
||||
import json
|
||||
import paho.mqtt.client as mqtt
|
||||
import openwakeword
|
||||
from openwakeword.model import Model
|
||||
import numpy as np
|
||||
import sounddevice as sd
|
||||
|
||||
# MQTT Configuration
|
||||
MQTT_HOST = "192.168.0.39" # Home Assistant IP
|
||||
MQTT_PORT = 1883
|
||||
MQTT_USER = "your_mqtt_username" # Replace with your MQTT username
|
||||
MQTT_PASS = "your_mqtt_password" # Replace with your MQTT password
|
||||
MQTT_TOPIC = "homeassistant/openwakeword/detection"
|
||||
|
||||
# Wake word detection threshold (0.0 - 1.0)
|
||||
THRESHOLD = 0.5
|
||||
|
||||
# Audio settings
|
||||
CHUNK_SIZE = 1600 # 100ms of audio @ 16kHz
|
||||
|
||||
def on_connect(client, userdata, flags, rc):
|
||||
if rc == 0:
|
||||
print(f"Connected to MQTT broker at {MQTT_HOST}")
|
||||
else:
|
||||
print(f"Failed to connect, return code {rc}")
|
||||
|
||||
def publish_detection(wake_word, confidence):
|
||||
payload = json.dumps({
|
||||
"wake_word": wake_word,
|
||||
"confidence": float(confidence),
|
||||
"timestamp": time.time()
|
||||
})
|
||||
client.publish(MQTT_TOPIC, payload)
|
||||
print(f"Published: {wake_word} ({confidence:.2f})")
|
||||
|
||||
def main():
|
||||
global client
|
||||
|
||||
# Initialize MQTT client
|
||||
client = mqtt.Client(client_id="openwakeword")
|
||||
client.username_pw_set(MQTT_USER, MQTT_PASS)
|
||||
client.on_connect = on_connect
|
||||
client.connect(MQTT_HOST, MQTT_PORT, 60)
|
||||
client.loop_start()
|
||||
|
||||
# Initialize openwakeword model
|
||||
print("Loading openwakeword models...")
|
||||
oww_model = Model()
|
||||
|
||||
# Get audio stream (adjust for your microphone)
|
||||
# Using sounddevice for microphone input
|
||||
import sounddevice as sd
|
||||
|
||||
def audio_callback(indata, frames, time, status):
|
||||
if status:
|
||||
print(status)
|
||||
# Process audio for wake word detection
|
||||
audio_data = indata.flatten()
|
||||
predictions = oww_model.predict(audio_data)
|
||||
|
||||
# Check for detections
|
||||
for wake_word, score in predictions.items():
|
||||
if score >= THRESHOLD:
|
||||
publish_detection(wake_word, score)
|
||||
|
||||
print("Listening for wake words...")
|
||||
print("Press Ctrl+C to stop")
|
||||
|
||||
# Start streaming from microphone
|
||||
with sd.InputStream(
|
||||
channels=1,
|
||||
samplerate=16000,
|
||||
dtype='int16',
|
||||
blocksize=CHUNK_SIZE,
|
||||
callback=audio_callback
|
||||
):
|
||||
try:
|
||||
while True:
|
||||
time.sleep(0.1)
|
||||
except KeyboardInterrupt:
|
||||
print("\nStopping...")
|
||||
client.loop_stop()
|
||||
client.disconnect()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
1
home-assistant/owmq.json
Normal file
1
home-assistant/owmq.json
Normal file
File diff suppressed because one or more lines are too long
8
home-assistant/parse-brave.ps1
Normal file
8
home-assistant/parse-brave.ps1
Normal file
@@ -0,0 +1,8 @@
|
||||
$data = Get-Content brave_results.json -Raw | ConvertFrom-Json
|
||||
$results = $data.web.results | Select-Object -First 5
|
||||
foreach ($r in $results) {
|
||||
Write-Host "=== $($r.title) ==="
|
||||
Write-Host "$($r.url)"
|
||||
Write-Host "$($r.description)"
|
||||
Write-Host ""
|
||||
}
|
||||
1
home-assistant/vpe_ow.json
Normal file
1
home-assistant/vpe_ow.json
Normal file
File diff suppressed because one or more lines are too long
1
home-assistant/wake_results.json
Normal file
1
home-assistant/wake_results.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user