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 let T = ./types.dhall
"password" }
in { mqtt_servers.default
=
{ host = "1.2.3.4", user = Some "username", pass = Some "password" }
, layers.default , layers.default
= =
{ default_mapping = Mapping.Print "no mapping!" { default_mapping = T.Action.Print "no mapping!"
, mappings = , mappings =
let sometopic = "homeassistant/switch/something/set" let sometopic = "homeassistant/switch/something/set"
in { key_0 = in { key_0 =
Mapping.Trigger (Action.MQTTPub { topic = sometopic, payload = "ON" }) T.Mapping.Trigger
(T.Action.MQTTPub { topic = sometopic, payload = "ON" })
, key_1 = , key_1 =
Mapping.Trigger T.Mapping.Trigger
(Action.MQTTPub { topic = sometopic, payload = "OFF" }) (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; [ buildInputs = with pkgs; [
# Dhall (config) stuff # Dhall (config) stuff
dhall dhall
dhall-json
dhall-lsp-server dhall-lsp-server
# Rust! # Rust!
(rust-bin.stable.latest.default.override { (rust-bin.stable.latest.default.override {