Add luz-sala remote control from local Home Assistant

Installs ha-bridge.py on vini@192.168.1.105 as a systemd user service
that proxies light commands to the remote HA via JWT authentication.
Local HA gets rest_command, rest sensor, template switch, and a
button-card for both dashboards.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ltadeu6 2026-05-17 16:28:32 -03:00
parent f85cf6b2df
commit 82e6ed9271
No known key found for this signature in database
GPG key ID: FB9FDAB6B6F3418D
3 changed files with 202 additions and 0 deletions

View file

@ -9,6 +9,8 @@ let
repoDir = "${homeDir}/Projetos/Sistemas/nixos-config";
codexStatusPath = "/var/lib/hass/codex_status.json";
claudeUsagePath = "/var/lib/hass/claude_usage.json";
luzSalaBridgeUrl = "http://192.168.1.105:8766";
luzSalaBridgeSecret = "a3c41709c9da4ea77059eb734570726950b9a70cb7af6a3bf0ece94d54d0c8c0";
haAirConditioner = "climate.ar";
haLaundryDryingToggle = "input_boolean.secar_roupas";
haClimateAction = action: data: {
@ -648,6 +650,56 @@ in {
}
];
}
{
switch = [
{
name = "Luz Sala";
unique_id = "luz_sala_remota_switch";
state = "{{ states('sensor.luz_sala_remota') == 'on' }}";
turn_on.action = "rest_command.luz_sala_turn_on";
turn_off.action = "rest_command.luz_sala_turn_off";
icon = "mdi:lightbulb";
}
];
}
];
rest_command = {
luz_sala_turn_on = {
url = "${luzSalaBridgeUrl}/turn_on";
method = "post";
headers = { X-Secret = luzSalaBridgeSecret; };
content_type = "application/json";
payload = "{}";
};
luz_sala_turn_off = {
url = "${luzSalaBridgeUrl}/turn_off";
method = "post";
headers = { X-Secret = luzSalaBridgeSecret; };
content_type = "application/json";
payload = "{}";
};
luz_sala_toggle = {
url = "${luzSalaBridgeUrl}/toggle";
method = "post";
headers = { X-Secret = luzSalaBridgeSecret; };
content_type = "application/json";
payload = "{}";
};
};
rest = [
{
resource = "${luzSalaBridgeUrl}/state";
headers = { X-Secret = luzSalaBridgeSecret; };
scan_interval = 10;
sensor = [{
name = "Luz Sala Remota";
unique_id = "luz_sala_remota";
value_template = "{{ value_json.state }}";
icon = "mdi:lightbulb";
}];
}
];
lovelace = {