Update and format config example

Also add dhall-json for testing json/yaml conversion
This commit is contained in:
Sam W 2022-07-11 14:02:51 +00:00
parent 7b2a92012b
commit 3065040189
2 changed files with 26 additions and 15 deletions

View File

@ -1,16 +1,26 @@
{ mqtt_servers.default = { host = "1.2.3.4", user = Some "username", pass = Some
"password" }
, layers.default
let T = ./types.dhall
in { mqtt_servers.default
=
{ default_mapping = Mapping.Print "no mapping!"
{ host = "1.2.3.4", user = Some "username", pass = Some "password" }
, layers.default
=
{ default_mapping = T.Action.Print "no mapping!"
, mappings =
let sometopic = "homeassistant/switch/something/set"
in { key_0 =
Mapping.Trigger (Action.MQTTPub { topic = sometopic, payload = "ON" })
T.Mapping.Trigger
(T.Action.MQTTPub { topic = sometopic, payload = "ON" })
, key_1 =
Mapping.Trigger
(Action.MQTTPub { topic = sometopic, payload = "OFF" })
T.Mapping.Trigger
(T.Action.MQTTPub { topic = sometopic, payload = "OFF" })
, key_2 =
T.Mapping.TriggerMulti
[ T.Action.Print "Doing a thing"
, T.Action.MQTTPub
{ topic = "thing/foo/bar", payload = "boop" }
]
}
}
}
}

View File

@ -34,6 +34,7 @@
buildInputs = with pkgs; [
# Dhall (config) stuff
dhall
dhall-json
dhall-lsp-server
# Rust!
(rust-bin.stable.latest.default.override {