From f9ec83473462b6b9cf11ea838efa9159ad664ee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20=C3=96hrstr=C3=B6m?= Date: Sun, 24 Nov 2024 01:36:59 +0100 Subject: [PATCH] Update shell script. --- drivers/send_ha_discovery.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/send_ha_discovery.sh b/drivers/send_ha_discovery.sh index 24f5756..5f21acb 100755 --- a/drivers/send_ha_discovery.sh +++ b/drivers/send_ha_discovery.sh @@ -1,7 +1,7 @@ #!/bin/bash # Use this script like this: -# ./build/wmbusmeters --shell='./drivers/send_ha_discovery.sh "$METER_DRIVER" "$METER_JSON"' 1844AE4C4455223368077A55000000_041389E20100023B0000 Vatten iperl 33225544 NOKEY +# ./build/wmbusmeters --format=json --metershell='./drivers/send_ha_discovery.sh "$METER_DRIVER" "$METER_JSON"' 1844AE4C4455223368077A55000000_041389E20100023B0000 Vatten iperl 33225544 NOKEY DRIVER=$(mktemp /tmp/send_ha_discovery.driver.XXXXXX) TELEGRAM=$(mktemp /tmp/send_ha_discovery.json.XXXXXX) @@ -12,18 +12,16 @@ cat <<< "$2" > $TELEGRAM echo // Telegram content ///////////////////////////////////////////// ./build/xmq $TELEGRAM for-each '/telegram/node()' --shell='echo "${..} ... ${.}"' echo // DRIVER as xmq ///////////////////////////////////////////// -xmq $DRIVER to-xmq --compact +./build/xmq $DRIVER to-xmq --compact echo // DRIVER as json ///////////////////////////////////////////// -xmq $DRIVER to-json +./build/xmq $DRIVER to-json echo // DRIVER as xml ///////////////////////////////////////////// -xmq $DRIVER to-xml +./build/xmq $DRIVER to-xml # Generate a HA meter config. Reads the first telegram but does not acutally use the content. echo // HA CONFIG ////////////////////////////////////////// ./build/xmq $DRIVER transform --stringparam=file=$TELEGRAM drivers/to-ha-discovery.xslq to-json echo /////////////////////////////////////////////////////// -# You can convert the driver to json, if you prefer this. -# ./build/xmq $DRIVER to-json > ${DRIVER}.json rm -f $DRIVER_XMQ rm -f $TELEGRAM_JSON