summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bureautomation/automation/hass-restart.nix
blob: 3b3ce05995ebcb01c7915a6dbf85d61b6fa7cdba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
  services.home-assistant.config.automation =
  [
    { alias = "State on HA start-up";
    trigger = {
        platform = "homeassistant";
        event = "start";
      };
      action = [
        # Startup State
        { service = "mqtt.publish";
          data = {
            topic = "/bam/sonoffs/cmnd/state";
            payload = "";
          };
        }
        # Firmware Version
        { service = "mqtt.publish";
          data = {
            topic = "/bam/sonoffs/cmnd/status";
            payload = "2";
          };
        }
        # Will trigger restart of all devices!
        #{ service = "mqtt.publish";
        #  data = {
        #    topic = "sonoffs/cmnd/SetOption59"; # configure sending state on power change
        #    payload = "1";
        #  };
        #}
      ];
    }
  ];
}