Control luz-sala directly via LocalTuya (xZetsubou fork)

Drops the bridge approach. Copies the localtuya custom component
(v2025.11.0) into the repo and symlinks it into /var/lib/hass via
systemd-tmpfiles on rebuild. Reverts all bridge-related config.
After rebuild, configure the integration via HA UI with the device
credentials already in the repo.

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

View file

@ -9,8 +9,6 @@ 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: {
@ -650,56 +648,6 @@ 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 = {
@ -1333,6 +1281,10 @@ in {
};
};
systemd.tmpfiles.rules = [
"L+ /var/lib/hass/custom_components/localtuya - hass hass - ${../../configs/home-assistant/custom_components/localtuya}"
];
systemd.timers."nix-flake-update" = {
wantedBy = [ "timers.target" ];
timerConfig = {