[
  {
    "id": "hfc_onair_tab",
    "type": "tab",
    "label": "HFConverse On the Air",
    "disabled": false,
    "info": "# HFConverse On the Air · v1.0\n\nShows who is on the air from the HFConverse On the Air list, and sends an alert when a station comes up or changes band.\n\nSet this tab's Environment Variables (double-click the tab, then the list icon), then open the dashboard page and pick your Dashboard UI.\n\nInstructions: https://mw0gbq.hamserve.uk/presence/node-red.html\n\nData: https://mw0gbq.hamserve.uk/presence/ (public, read-only; polled once a minute).",
    "env": [
      {
        "name": "MY_CALL",
        "value": "",
        "type": "str"
      },
      {
        "name": "WATCH_CALLS",
        "value": "",
        "type": "str"
      },
      {
        "name": "WATCH_BANDS",
        "value": "",
        "type": "str"
      },
      {
        "name": "WATCH_MODES",
        "value": "",
        "type": "str"
      },
      {
        "name": "PUSHOVER_TOKEN",
        "value": "",
        "type": "str"
      },
      {
        "name": "PUSHOVER_USER",
        "value": "",
        "type": "str"
      },
      {
        "name": "PUSHOVER_SOUND",
        "value": "pushover",
        "type": "str"
      }
    ]
  },
  {
    "id": "hfc_ui_theme",
    "type": "ui-theme",
    "name": "HFConverse",
    "colors": {
      "surface": "#201811",
      "primary": "#e2933f",
      "bgPage": "#eceae2",
      "groupBg": "#fbfaf6",
      "groupOutline": "#d5d1c4"
    },
    "sizes": {
      "density": "default",
      "pagePadding": "16px",
      "groupGap": "16px",
      "groupBorderRadius": "16px",
      "widgetGap": "12px"
    }
  },
  {
    "id": "hfc_ui_page",
    "type": "ui-page",
    "name": "HFC On the Air",
    "ui": "",
    "path": "/hfc-onair",
    "icon": "radio-tower",
    "layout": "grid",
    "theme": "hfc_ui_theme",
    "order": 99,
    "className": "",
    "visible": "true",
    "disabled": "false"
  },
  {
    "id": "hfc_g_list",
    "type": "ui-group",
    "name": "On the Air",
    "page": "hfc_ui_page",
    "width": "12",
    "height": "1",
    "order": 1,
    "showTitle": false,
    "className": "",
    "visible": "true",
    "disabled": "false"
  },
  {
    "id": "hfc_g_alerts",
    "type": "ui-group",
    "name": "Alerts",
    "page": "hfc_ui_page",
    "width": "12",
    "height": "1",
    "order": 2,
    "showTitle": true,
    "className": "",
    "visible": "true",
    "disabled": "false"
  },
  {
    "id": "hfc_c1",
    "type": "comment",
    "z": "hfc_onair_tab",
    "name": "Poll the On the Air list once a minute (please keep it at 60 s or more)",
    "info": "",
    "x": 300,
    "y": 40,
    "wires": []
  },
  {
    "id": "hfc_tick",
    "type": "inject",
    "z": "hfc_onair_tab",
    "name": "every 60 s",
    "props": [
      {
        "p": "payload"
      }
    ],
    "repeat": "60",
    "crontab": "",
    "once": true,
    "onceDelay": "3",
    "topic": "",
    "payload": "",
    "payloadType": "date",
    "x": 120,
    "y": 100,
    "wires": [
      [
        "hfc_get"
      ]
    ]
  },
  {
    "id": "hfc_get",
    "type": "http request",
    "z": "hfc_onair_tab",
    "name": "GET list.php",
    "method": "GET",
    "ret": "obj",
    "paytoqs": "ignore",
    "url": "https://mw0gbq.hamserve.uk/presence/list.php",
    "tls": "",
    "persist": false,
    "proxy": "",
    "insecureHTTPParser": false,
    "authType": "",
    "senderr": false,
    "headers": [
      {
        "keyType": "other",
        "keyValue": "User-Agent",
        "valueType": "other",
        "valueValue": "HFConverse-NodeRED/1.0 (+https://mw0gbq.hamserve.uk/presence/node-red.html)"
      }
    ],
    "x": 290,
    "y": 100,
    "wires": [
      [
        "hfc_spots"
      ]
    ]
  },
  {
    "id": "hfc_spots",
    "type": "function",
    "z": "hfc_onair_tab",
    "name": "spots + alerts",
    "func": "// Output 1 -> dashboard, 2 -> alerts\nconst TABLE = [[\"GD\",\"im\",\"Isle of Man\"],[\"MD\",\"im\",\"Isle of Man\"],[\"2D\",\"im\",\"Isle of Man\"],[\"GJ\",\"je\",\"Jersey\"],[\"MJ\",\"je\",\"Jersey\"],[\"2J\",\"je\",\"Jersey\"],[\"GU\",\"gg\",\"Guernsey\"],[\"MU\",\"gg\",\"Guernsey\"],[\"2U\",\"gg\",\"Guernsey\"],[\"GI\",\"gb-nir\",\"Northern Ireland\"],[\"MI\",\"gb-nir\",\"Northern Ireland\"],[\"2I\",\"gb-nir\",\"Northern Ireland\"],[\"GM\",\"gb-sct\",\"Scotland\"],[\"MM\",\"gb-sct\",\"Scotland\"],[\"2M\",\"gb-sct\",\"Scotland\"],[\"GW\",\"gb-wls\",\"Wales\"],[\"MW\",\"gb-wls\",\"Wales\"],[\"2W\",\"gb-wls\",\"Wales\"],[\"G\",\"gb-eng\",\"England\"],[\"M\",\"gb-eng\",\"England\"],[\"2E\",\"gb-eng\",\"England\"],[\"ZB\",\"gi\",\"Gibraltar\"],[\"EI\",\"ie\",\"Ireland\"],[\"EJ\",\"ie\",\"Ireland\"],[\"DL\",\"de\",\"Germany\"],[\"DA\",\"de\",\"Germany\"],[\"DB\",\"de\",\"Germany\"],[\"DC\",\"de\",\"Germany\"],[\"DD\",\"de\",\"Germany\"],[\"DF\",\"de\",\"Germany\"],[\"DG\",\"de\",\"Germany\"],[\"DH\",\"de\",\"Germany\"],[\"DJ\",\"de\",\"Germany\"],[\"DK\",\"de\",\"Germany\"],[\"DM\",\"de\",\"Germany\"],[\"DO\",\"de\",\"Germany\"],[\"DP\",\"de\",\"Germany\"],[\"DQ\",\"de\",\"Germany\"],[\"DR\",\"de\",\"Germany\"],[\"F\",\"fr\",\"France\"],[\"TM\",\"fr\",\"France\"],[\"TO\",\"fr\",\"France\"],[\"I\",\"it\",\"Italy\"],[\"IZ\",\"it\",\"Italy\"],[\"IK\",\"it\",\"Italy\"],[\"IW\",\"it\",\"Italy\"],[\"IU\",\"it\",\"Italy\"],[\"IS0\",\"it\",\"Italy\"],[\"EA\",\"es\",\"Spain\"],[\"EB\",\"es\",\"Spain\"],[\"EC\",\"es\",\"Spain\"],[\"ED\",\"es\",\"Spain\"],[\"CT\",\"pt\",\"Portugal\"],[\"CU\",\"pt\",\"Portugal\"],[\"CS\",\"pt\",\"Portugal\"],[\"ON\",\"be\",\"Belgium\"],[\"OO\",\"be\",\"Belgium\"],[\"OP\",\"be\",\"Belgium\"],[\"OQ\",\"be\",\"Belgium\"],[\"OR\",\"be\",\"Belgium\"],[\"OS\",\"be\",\"Belgium\"],[\"OT\",\"be\",\"Belgium\"],[\"PA\",\"nl\",\"Netherlands\"],[\"PB\",\"nl\",\"Netherlands\"],[\"PC\",\"nl\",\"Netherlands\"],[\"PD\",\"nl\",\"Netherlands\"],[\"PE\",\"nl\",\"Netherlands\"],[\"PF\",\"nl\",\"Netherlands\"],[\"PG\",\"nl\",\"Netherlands\"],[\"PH\",\"nl\",\"Netherlands\"],[\"PI\",\"nl\",\"Netherlands\"],[\"LX\",\"lu\",\"Luxembourg\"],[\"HB9\",\"ch\",\"Switzerland\"],[\"HB3\",\"ch\",\"Switzerland\"],[\"HE\",\"ch\",\"Switzerland\"],[\"HB0\",\"li\",\"Liechtenstein\"],[\"OE\",\"at\",\"Austria\"],[\"SM\",\"se\",\"Sweden\"],[\"SA\",\"se\",\"Sweden\"],[\"SB\",\"se\",\"Sweden\"],[\"SC\",\"se\",\"Sweden\"],[\"SD\",\"se\",\"Sweden\"],[\"SE\",\"se\",\"Sweden\"],[\"SF\",\"se\",\"Sweden\"],[\"SG\",\"se\",\"Sweden\"],[\"SH\",\"se\",\"Sweden\"],[\"SI\",\"se\",\"Sweden\"],[\"SJ\",\"se\",\"Sweden\"],[\"SK\",\"se\",\"Sweden\"],[\"SL\",\"se\",\"Sweden\"],[\"LA\",\"no\",\"Norway\"],[\"LB\",\"no\",\"Norway\"],[\"LC\",\"no\",\"Norway\"],[\"LG\",\"no\",\"Norway\"],[\"LH\",\"no\",\"Norway\"],[\"LI\",\"no\",\"Norway\"],[\"LJ\",\"no\",\"Norway\"],[\"LN\",\"no\",\"Norway\"],[\"OZ\",\"dk\",\"Denmark\"],[\"5P\",\"dk\",\"Denmark\"],[\"5Q\",\"dk\",\"Denmark\"],[\"OX\",\"gl\",\"Greenland\"],[\"OY\",\"fo\",\"Faroe Islands\"],[\"OJ0\",\"ax\",\"Åland Islands\"],[\"OH\",\"fi\",\"Finland\"],[\"TF\",\"is\",\"Iceland\"],[\"SP\",\"pl\",\"Poland\"],[\"SQ\",\"pl\",\"Poland\"],[\"SN\",\"pl\",\"Poland\"],[\"SO\",\"pl\",\"Poland\"],[\"SR\",\"pl\",\"Poland\"],[\"3Z\",\"pl\",\"Poland\"],[\"HF\",\"pl\",\"Poland\"],[\"OK\",\"cz\",\"Czechia\"],[\"OL\",\"cz\",\"Czechia\"],[\"OM\",\"sk\",\"Slovakia\"],[\"HA\",\"hu\",\"Hungary\"],[\"HG\",\"hu\",\"Hungary\"],[\"YO\",\"ro\",\"Romania\"],[\"YP\",\"ro\",\"Romania\"],[\"YQ\",\"ro\",\"Romania\"],[\"YR\",\"ro\",\"Romania\"],[\"LZ\",\"bg\",\"Bulgaria\"],[\"9A\",\"hr\",\"Croatia\"],[\"S5\",\"si\",\"Slovenia\"],[\"E7\",\"ba\",\"Bosnia and Herzegovina\"],[\"4O\",\"me\",\"Montenegro\"],[\"YU\",\"rs\",\"Serbia\"],[\"YT\",\"rs\",\"Serbia\"],[\"Z3\",\"mk\",\"North Macedonia\"],[\"ZA\",\"al\",\"Albania\"],[\"SV\",\"gr\",\"Greece\"],[\"SW\",\"gr\",\"Greece\"],[\"SX\",\"gr\",\"Greece\"],[\"SY\",\"gr\",\"Greece\"],[\"SZ\",\"gr\",\"Greece\"],[\"J4\",\"gr\",\"Greece\"],[\"TA\",\"tr\",\"Turkey\"],[\"TC\",\"tr\",\"Turkey\"],[\"UR\",\"ua\",\"Ukraine\"],[\"UT\",\"ua\",\"Ukraine\"],[\"UU\",\"ua\",\"Ukraine\"],[\"UV\",\"ua\",\"Ukraine\"],[\"UW\",\"ua\",\"Ukraine\"],[\"UX\",\"ua\",\"Ukraine\"],[\"UY\",\"ua\",\"Ukraine\"],[\"UZ\",\"ua\",\"Ukraine\"],[\"EM\",\"ua\",\"Ukraine\"],[\"EN\",\"ua\",\"Ukraine\"],[\"EO\",\"ua\",\"Ukraine\"],[\"EU\",\"by\",\"Belarus\"],[\"EV\",\"by\",\"Belarus\"],[\"EW\",\"by\",\"Belarus\"],[\"YL\",\"lv\",\"Latvia\"],[\"LY\",\"lt\",\"Lithuania\"],[\"ES\",\"ee\",\"Estonia\"],[\"ER\",\"md\",\"Moldova\"],[\"3A\",\"mc\",\"Monaco\"],[\"T7\",\"sm\",\"San Marino\"],[\"9H\",\"mt\",\"Malta\"],[\"C3\",\"ad\",\"Andorra\"],[\"HV\",\"va\",\"Vatican City\"],[\"5B\",\"cy\",\"Cyprus\"],[\"C4\",\"cy\",\"Cyprus\"],[\"H2\",\"cy\",\"Cyprus\"],[\"P3\",\"cy\",\"Cyprus\"],[\"R\",\"ru\",\"Russia\"],[\"UA\",\"ru\",\"Russia\"],[\"UB\",\"ru\",\"Russia\"],[\"UC\",\"ru\",\"Russia\"],[\"UD\",\"ru\",\"Russia\"],[\"UF\",\"ru\",\"Russia\"],[\"UG\",\"ru\",\"Russia\"],[\"UH\",\"ru\",\"Russia\"],[\"UI\",\"ru\",\"Russia\"],[\"4L\",\"ge\",\"Georgia\"],[\"EK\",\"am\",\"Armenia\"],[\"4J\",\"az\",\"Azerbaijan\"],[\"4K\",\"az\",\"Azerbaijan\"],[\"EX\",\"kg\",\"Kyrgyzstan\"],[\"EY\",\"tj\",\"Tajikistan\"],[\"EZ\",\"tm\",\"Turkmenistan\"],[\"UJ\",\"uz\",\"Uzbekistan\"],[\"UK\",\"uz\",\"Uzbekistan\"],[\"UL\",\"uz\",\"Uzbekistan\"],[\"UM\",\"uz\",\"Uzbekistan\"],[\"KP4\",\"pr\",\"Puerto Rico\"],[\"NP4\",\"pr\",\"Puerto Rico\"],[\"WP4\",\"pr\",\"Puerto Rico\"],[\"KP3\",\"pr\",\"Puerto Rico\"],[\"KP2\",\"vi\",\"US Virgin Islands\"],[\"NP2\",\"vi\",\"US Virgin Islands\"],[\"WP2\",\"vi\",\"US Virgin Islands\"],[\"K\",\"us\",\"United States\"],[\"N\",\"us\",\"United States\"],[\"W\",\"us\",\"United States\"],[\"AA\",\"us\",\"United States\"],[\"AB\",\"us\",\"United States\"],[\"AC\",\"us\",\"United States\"],[\"AD\",\"us\",\"United States\"],[\"AE\",\"us\",\"United States\"],[\"AF\",\"us\",\"United States\"],[\"AG\",\"us\",\"United States\"],[\"AI\",\"us\",\"United States\"],[\"AJ\",\"us\",\"United States\"],[\"AK\",\"us\",\"United States\"],[\"AL\",\"us\",\"United States\"],[\"VE\",\"ca\",\"Canada\"],[\"VA\",\"ca\",\"Canada\"],[\"VO\",\"ca\",\"Canada\"],[\"VY\",\"ca\",\"Canada\"],[\"VX\",\"ca\",\"Canada\"],[\"CF\",\"ca\",\"Canada\"],[\"CG\",\"ca\",\"Canada\"],[\"CH\",\"ca\",\"Canada\"],[\"CI\",\"ca\",\"Canada\"],[\"CJ\",\"ca\",\"Canada\"],[\"CK\",\"ca\",\"Canada\"],[\"CY\",\"ca\",\"Canada\"],[\"CZ\",\"ca\",\"Canada\"],[\"XE\",\"mx\",\"Mexico\"],[\"XF\",\"mx\",\"Mexico\"],[\"C6\",\"bs\",\"Bahamas\"],[\"8P\",\"bb\",\"Barbados\"],[\"J3\",\"gd\",\"Grenada\"],[\"J6\",\"lc\",\"Saint Lucia\"],[\"J7\",\"dm\",\"Dominica\"],[\"J8\",\"vc\",\"Saint Vincent and the Grenadines\"],[\"V2\",\"ag\",\"Antigua and Barbuda\"],[\"V3\",\"bz\",\"Belize\"],[\"V4\",\"kn\",\"Saint Kitts and Nevis\"],[\"YS\",\"sv\",\"El Salvador\"],[\"YN\",\"ni\",\"Nicaragua\"],[\"TG\",\"gt\",\"Guatemala\"],[\"HR\",\"hn\",\"Honduras\"],[\"TI\",\"cr\",\"Costa Rica\"],[\"HP\",\"pa\",\"Panama\"],[\"CO\",\"cu\",\"Cuba\"],[\"CM\",\"cu\",\"Cuba\"],[\"HI\",\"do\",\"Dominican Republic\"],[\"HH\",\"ht\",\"Haiti\"],[\"ZF\",\"ky\",\"Cayman Islands\"],[\"VP5\",\"tc\",\"Turks and Caicos Islands\"],[\"VP9\",\"bm\",\"Bermuda\"],[\"FG\",\"gp\",\"Guadeloupe\"],[\"FM\",\"mq\",\"Martinique\"],[\"FS\",\"mf\",\"Saint Martin\"],[\"FJ\",\"bl\",\"Saint Barthélemy\"],[\"PJ2\",\"cw\",\"Curaçao\"],[\"PJ4\",\"cw\",\"Curaçao\"],[\"PJ7\",\"sx\",\"Sint Maarten\"],[\"PJ5\",\"bq\",\"Caribbean Netherlands\"],[\"PJ6\",\"bq\",\"Caribbean Netherlands\"],[\"8R\",\"gy\",\"Guyana\"],[\"PZ\",\"sr\",\"Suriname\"],[\"FY\",\"gf\",\"French Guiana\"],[\"LU\",\"ar\",\"Argentina\"],[\"LW\",\"ar\",\"Argentina\"],[\"LO\",\"ar\",\"Argentina\"],[\"LP\",\"ar\",\"Argentina\"],[\"LQ\",\"ar\",\"Argentina\"],[\"LR\",\"ar\",\"Argentina\"],[\"LS\",\"ar\",\"Argentina\"],[\"LT\",\"ar\",\"Argentina\"],[\"LV\",\"ar\",\"Argentina\"],[\"AY\",\"ar\",\"Argentina\"],[\"AZ\",\"ar\",\"Argentina\"],[\"CE\",\"cl\",\"Chile\"],[\"CX\",\"uy\",\"Uruguay\"],[\"ZP\",\"py\",\"Paraguay\"],[\"CP\",\"bo\",\"Bolivia\"],[\"OA\",\"pe\",\"Peru\"],[\"OB\",\"pe\",\"Peru\"],[\"OC\",\"pe\",\"Peru\"],[\"HC\",\"ec\",\"Ecuador\"],[\"HD\",\"ec\",\"Ecuador\"],[\"HK\",\"co\",\"Colombia\"],[\"YV\",\"ve\",\"Venezuela\"],[\"YW\",\"ve\",\"Venezuela\"],[\"YX\",\"ve\",\"Venezuela\"],[\"YY\",\"ve\",\"Venezuela\"],[\"PY\",\"br\",\"Brazil\"],[\"PP\",\"br\",\"Brazil\"],[\"PQ\",\"br\",\"Brazil\"],[\"PR\",\"br\",\"Brazil\"],[\"PS\",\"br\",\"Brazil\"],[\"PT\",\"br\",\"Brazil\"],[\"PU\",\"br\",\"Brazil\"],[\"ZV\",\"br\",\"Brazil\"],[\"ZW\",\"br\",\"Brazil\"],[\"ZX\",\"br\",\"Brazil\"],[\"ZY\",\"br\",\"Brazil\"],[\"ZZ\",\"br\",\"Brazil\"],[\"JA\",\"jp\",\"Japan\"],[\"JE\",\"jp\",\"Japan\"],[\"JF\",\"jp\",\"Japan\"],[\"JG\",\"jp\",\"Japan\"],[\"JH\",\"jp\",\"Japan\"],[\"JI\",\"jp\",\"Japan\"],[\"JJ\",\"jp\",\"Japan\"],[\"JK\",\"jp\",\"Japan\"],[\"JL\",\"jp\",\"Japan\"],[\"JM\",\"jp\",\"Japan\"],[\"JN\",\"jp\",\"Japan\"],[\"JO\",\"jp\",\"Japan\"],[\"JP\",\"jp\",\"Japan\"],[\"JQ\",\"jp\",\"Japan\"],[\"JR\",\"jp\",\"Japan\"],[\"JS\",\"jp\",\"Japan\"],[\"HL\",\"kr\",\"South Korea\"],[\"DS\",\"kr\",\"South Korea\"],[\"D7\",\"kr\",\"South Korea\"],[\"D8\",\"kr\",\"South Korea\"],[\"D9\",\"kr\",\"South Korea\"],[\"6K\",\"kr\",\"South Korea\"],[\"6L\",\"kr\",\"South Korea\"],[\"BY\",\"cn\",\"China\"],[\"BT\",\"cn\",\"China\"],[\"BG\",\"cn\",\"China\"],[\"B\",\"cn\",\"China\"],[\"BV\",\"tw\",\"Taiwan\"],[\"VR\",\"hk\",\"Hong Kong\"],[\"XX9\",\"mo\",\"Macau\"],[\"9V\",\"sg\",\"Singapore\"],[\"9M2\",\"my\",\"Malaysia\"],[\"9M4\",\"my\",\"Malaysia\"],[\"9M6\",\"my\",\"Malaysia\"],[\"9M8\",\"my\",\"Malaysia\"],[\"HS\",\"th\",\"Thailand\"],[\"E2\",\"th\",\"Thailand\"],[\"XV\",\"vn\",\"Vietnam\"],[\"3W\",\"vn\",\"Vietnam\"],[\"XU\",\"kh\",\"Cambodia\"],[\"XW\",\"la\",\"Laos\"],[\"XZ\",\"mm\",\"Myanmar\"],[\"DU\",\"ph\",\"Philippines\"],[\"DV\",\"ph\",\"Philippines\"],[\"DW\",\"ph\",\"Philippines\"],[\"DX\",\"ph\",\"Philippines\"],[\"DY\",\"ph\",\"Philippines\"],[\"DZ\",\"ph\",\"Philippines\"],[\"4D\",\"ph\",\"Philippines\"],[\"4E\",\"ph\",\"Philippines\"],[\"4F\",\"ph\",\"Philippines\"],[\"YB\",\"id\",\"Indonesia\"],[\"YC\",\"id\",\"Indonesia\"],[\"YD\",\"id\",\"Indonesia\"],[\"YE\",\"id\",\"Indonesia\"],[\"YF\",\"id\",\"Indonesia\"],[\"YG\",\"id\",\"Indonesia\"],[\"YH\",\"id\",\"Indonesia\"],[\"VU\",\"in\",\"India\"],[\"AP\",\"pk\",\"Pakistan\"],[\"S2\",\"bd\",\"Bangladesh\"],[\"4S\",\"lk\",\"Sri Lanka\"],[\"9N\",\"np\",\"Nepal\"],[\"A5\",\"bt\",\"Bhutan\"],[\"T6\",\"af\",\"Afghanistan\"],[\"YA\",\"af\",\"Afghanistan\"],[\"4X\",\"il\",\"Israel\"],[\"4Z\",\"il\",\"Israel\"],[\"JY\",\"jo\",\"Jordan\"],[\"OD\",\"lb\",\"Lebanon\"],[\"YK\",\"sy\",\"Syria\"],[\"A4\",\"om\",\"Oman\"],[\"A6\",\"ae\",\"United Arab Emirates\"],[\"A7\",\"qa\",\"Qatar\"],[\"A9\",\"bh\",\"Bahrain\"],[\"HZ\",\"sa\",\"Saudi Arabia\"],[\"7Z\",\"sa\",\"Saudi Arabia\"],[\"8Z\",\"sa\",\"Saudi Arabia\"],[\"YI\",\"iq\",\"Iraq\"],[\"EP\",\"ir\",\"Iran\"],[\"EQ\",\"ir\",\"Iran\"],[\"9K\",\"kw\",\"Kuwait\"],[\"7O\",\"ye\",\"Yemen\"],[\"VK\",\"au\",\"Australia\"],[\"ZL\",\"nz\",\"New Zealand\"],[\"ZM\",\"nz\",\"New Zealand\"],[\"KH6\",\"us\",\"United States\"],[\"KH7\",\"us\",\"United States\"],[\"KL7\",\"us\",\"United States\"],[\"FK\",\"nc\",\"New Caledonia\"],[\"FO\",\"pf\",\"French Polynesia\"],[\"YJ\",\"vu\",\"Vanuatu\"],[\"3D2\",\"fj\",\"Fiji\"],[\"A3\",\"to\",\"Tonga\"],[\"5W\",\"ws\",\"Samoa\"],[\"V6\",\"fm\",\"Micronesia\"],[\"V7\",\"mh\",\"Marshall Islands\"],[\"T8\",\"pw\",\"Palau\"],[\"KC6\",\"pw\",\"Palau\"],[\"P2\",\"pg\",\"Papua New Guinea\"],[\"H4\",\"sb\",\"Solomon Islands\"],[\"C2\",\"nr\",\"Nauru\"],[\"T3\",\"ki\",\"Kiribati\"],[\"T2\",\"tv\",\"Tuvalu\"],[\"VK9\",\"au\",\"Australia\"],[\"VK0\",\"au\",\"Australia\"],[\"ZS\",\"za\",\"South Africa\"],[\"ZR\",\"za\",\"South Africa\"],[\"ZT\",\"za\",\"South Africa\"],[\"ZU\",\"za\",\"South Africa\"],[\"SU\",\"eg\",\"Egypt\"],[\"CN\",\"ma\",\"Morocco\"],[\"7X\",\"dz\",\"Algeria\"],[\"TS\",\"tn\",\"Tunisia\"],[\"3V\",\"tn\",\"Tunisia\"],[\"5A\",\"ly\",\"Libya\"],[\"ST\",\"sd\",\"Sudan\"],[\"ET\",\"et\",\"Ethiopia\"],[\"5Z\",\"ke\",\"Kenya\"],[\"5H\",\"tz\",\"Tanzania\"],[\"5X\",\"ug\",\"Uganda\"],[\"9J\",\"zm\",\"Zambia\"],[\"Z2\",\"zw\",\"Zimbabwe\"],[\"7Q\",\"mw\",\"Malawi\"],[\"C9\",\"mz\",\"Mozambique\"],[\"A2\",\"bw\",\"Botswana\"],[\"V5\",\"na\",\"Namibia\"],[\"3DA\",\"sz\",\"Eswatini\"],[\"7P\",\"ls\",\"Lesotho\"],[\"6W\",\"sn\",\"Senegal\"],[\"6V\",\"sn\",\"Senegal\"],[\"9G\",\"gh\",\"Ghana\"],[\"5N\",\"ng\",\"Nigeria\"],[\"TU\",\"ci\",\"Côte d'Ivoire\"],[\"TZ\",\"ml\",\"Mali\"],[\"XT\",\"bf\",\"Burkina Faso\"],[\"9L\",\"sl\",\"Sierra Leone\"],[\"EL\",\"lr\",\"Liberia\"],[\"C5\",\"gm\",\"Gambia\"],[\"J5\",\"gw\",\"Guinea-Bissau\"],[\"3X\",\"gn\",\"Guinea\"],[\"TY\",\"bj\",\"Benin\"],[\"5V\",\"tg\",\"Togo\"],[\"TR\",\"ga\",\"Gabon\"],[\"TN\",\"cg\",\"Republic of the Congo\"],[\"9Q\",\"cd\",\"DR Congo\"],[\"TJ\",\"cm\",\"Cameroon\"],[\"TL\",\"cf\",\"Central African Republic\"],[\"TT\",\"td\",\"Chad\"],[\"D2\",\"ao\",\"Angola\"],[\"D3\",\"ao\",\"Angola\"],[\"ZD7\",\"sh\",\"Saint Helena\"],[\"ZD8\",\"sh\",\"Saint Helena\"],[\"ZD9\",\"sh\",\"Saint Helena\"]].sort((a, b) => b[0].length - a[0].length);\nfunction country(call) {\n    const c = String(call || '').toUpperCase().split('/')[0];\n    for (const t of TABLE) if (c.startsWith(t[0])) return { iso: t[1], name: t[2] };\n    return null;\n}\nconst BANDS = [[1800,2000,'160m'],[3500,4000,'80m'],[5250,5450,'60m'],[7000,7300,'40m'],[10100,10150,'30m'],\n               [14000,14350,'20m'],[18068,18168,'17m'],[21000,21450,'15m'],[24890,24990,'12m'],[28000,29700,'10m']];\nfunction band(khz) { const b = BANDS.find(r => khz >= r[0] - 5 && khz <= r[1] + 5); return b ? b[2] : ''; }\nconst list = v => String(v || '').toUpperCase().split(/[\\s,]+/).filter(Boolean);\nconst base = c => String(c || '').toUpperCase().split('/')[0];\n\nif (msg.statusCode !== 200 || !msg.payload || !Array.isArray(msg.payload.spots)) {\n    node.status({ fill: 'red', shape: 'ring', text: 'list unreachable' });\n    return [{ payload: { ok: false, spots: [], updated: new Date().toISOString() } }, null];\n}\n\nconst rows = msg.payload.spots.map(s => {\n    const khz = Number(s.cf_khz);\n    const mode = String(s.mode || '').trim().toUpperCase();\n    const ctry = country(s.callsign);\n    return {\n        key: String(s.callsign || '').toUpperCase() + '|' + String(s.station || ''),\n        callsign: String(s.callsign || '').toUpperCase(),\n        khz: isFinite(khz) ? khz : null,\n        freq: isFinite(khz) ? khz.toFixed(2) : String(s.cf_khz || ''),\n        cf: mode === 'PACTOR',\n        cw: mode === 'CW',\n        band: isFinite(khz) ? band(khz) : '',\n        mode, activity: s.activity || '', locator: s.locator || '',\n        last_seen_utc: s.last_seen_utc || '',\n        iso: ctry ? ctry.iso : '', country: ctry ? ctry.name : ''\n    };\n});\n\n// ---- alerts: a station comes up, or moves to another band\nconst me = list(env.get('MY_CALL')).map(base);\nconst calls = list(env.get('WATCH_CALLS'));\nconst bands = list(env.get('WATCH_BANDS')).map(b => b.toLowerCase().replace(/m?$/, 'm'));\nconst modes = list(env.get('WATCH_MODES'));\nconst wanted = r => !me.includes(base(r.callsign))\n    && (!calls.length || calls.includes(r.callsign) || calls.includes(base(r.callsign)))\n    && (!bands.length || bands.includes(r.band.toLowerCase()))\n    && (!modes.length || modes.includes(r.mode));\n\nconst prev = context.get('prev');\nconst now = {};\nrows.forEach(r => now[r.key] = r.band);\ncontext.set('prev', now);\n\nconst alerts = [];\nif (prev) {\n    for (const r of rows) {\n        if (!wanted(r)) continue;\n        const was = prev[r.key];\n        let title = null;\n        if (was === undefined) title = r.callsign + ' is on the air' + (r.band ? ' — ' + r.band : '');\n        else if (r.band && was && was !== r.band) title = r.callsign + ' has moved to ' + r.band;\n        if (!title) continue;\n        alerts.push({\n            topic: title,\n            payload: (r.mode || 'On') + ' on ' + r.freq + ' kHz (' + (r.cf ? 'CF' : 'dial') + ')\\n'\n                   + 'Activity: ' + (r.activity || '—') + (r.locator ? ' · Grid: ' + r.locator : ''),\n            spot: r\n        });\n    }\n}\n\nnode.status({ fill: 'green', shape: 'dot', text: rows.length + ' on air' + (prev ? '' : ' (first poll, no alerts)') });\nreturn [{ payload: { ok: true, spots: rows, updated: new Date().toISOString() } }, alerts.length ? alerts : null];\n",
    "outputs": 2,
    "timeout": 0,
    "noerr": 0,
    "initialize": "// Forget the previous list on every (re)start, so the first poll\n// after a restart records who is on air without alerting.\ncontext.set('prev', null);\n",
    "finalize": "",
    "libs": [],
    "info": "Output 1: list for the dashboard. Output 2: one message per alert (msg.topic = title, msg.payload = body, msg.spot = the spot).",
    "x": 470,
    "y": 100,
    "wires": [
      [
        "hfc_view"
      ],
      [
        "hfc_mute_gate"
      ]
    ]
  },
  {
    "id": "hfc_view",
    "type": "ui-template",
    "z": "hfc_onair_tab",
    "group": "hfc_g_list",
    "page": "",
    "ui": "",
    "name": "On the Air list",
    "order": 1,
    "width": "0",
    "height": "0",
    "head": "",
    "format": "<template>\n  <div class=\"hfc-oa\">\n    <div class=\"hfc-oa-head\">\n      <img src=\"https://mw0gbq.hamserve.uk/hfc-icon.png\" width=\"30\" height=\"30\" alt=\"\">\n      <div>\n        <div class=\"hfc-oa-eyebrow\">On the Air</div>\n        <div class=\"hfc-oa-title\">Who's on the air right now</div>\n      </div>\n    </div>\n    <p class=\"hfc-oa-status\"><span :class=\"['hfc-oa-dot', live ? '' : 'off']\"></span>{{ statusText }}</p>\n    <div class=\"hfc-oa-wrap\">\n      <table class=\"hfc-oa-table\">\n        <thead><tr>\n          <th>Callsign</th><th>Frequency</th><th>Activity</th>\n          <th class=\"hide-sm\">Mode</th><th class=\"hide-sm\">Grid</th><th>Last seen</th>\n        </tr></thead>\n        <tbody>\n          <tr v-if=\"!rows.length\"><td colspan=\"6\" class=\"empty\">{{ emptyText }}</td></tr>\n          <tr v-for=\"s in rows\" :key=\"s.key\">\n            <td class=\"call\"><img v-if=\"s.iso\" class=\"flag\" :src=\"'https://mw0gbq.hamserve.uk/assets/flags/' + s.iso + '.png'\" :alt=\"s.country\" :title=\"s.country\" @error=\"$event.target.style.display = 'none'\"><span>{{ s.callsign }}</span></td>\n            <td :class=\"['freq', s.cf ? 'cf' : '']\">{{ s.freq }} <small>{{ s.cf ? 'kHz · CF' : (s.cw ? 'kHz · CW' : 'kHz · dial') }}</small></td>\n            <td class=\"act\">{{ s.activity || '—' }}</td>\n            <td class=\"mono hide-sm\">{{ s.mode || '—' }}</td>\n            <td class=\"mono hide-sm\">{{ s.locator || '—' }}</td>\n            <td class=\"seen\">{{ rel(s.last_seen_utc) }}</td>\n          </tr>\n        </tbody>\n      </table>\n    </div>\n    <p class=\"hfc-oa-note\">PACTOR rows show the centre frequency (CF): set your dial 1.5 kHz lower. CW rows show the CW signal itself. Other modes show the dial frequency. Data from <a href=\"https://mw0gbq.hamserve.uk/presence/\" target=\"_blank\" rel=\"noopener\">HFConverse On the Air</a>, refreshed every minute.</p>\n  </div>\n</template>\n\n<script>\nexport default {\n  data() { return { tick: Date.now(), timer: null }; },\n  computed: {\n    data() { return (this.msg && this.msg.payload) || null; },\n    rows() { return (this.data && this.data.spots) || []; },\n    live() { return !!(this.data && this.data.ok && this.rows.length); },\n    statusText() {\n      if (!this.data) return 'Waiting for the first update…';\n      if (!this.data.ok) return 'Couldn’t reach the On the Air list — retrying';\n      const n = this.rows.length;\n      return n + (n === 1 ? ' station' : ' stations') + ' on the air · updated ' + this.hhmm(this.data.updated);\n    },\n    emptyText() {\n      if (!this.data) return 'Loading…';\n      return this.data.ok ? 'No stations are announcing right now.' : 'The On the Air list can’t be reached at the moment.';\n    }\n  },\n  mounted() { this.timer = setInterval(() => { this.tick = Date.now(); }, 30000); },\n  unmounted() { clearInterval(this.timer); },\n  methods: {\n    hhmm(iso) { const d = new Date(iso); return isNaN(d) ? '' : d.toTimeString().slice(0, 5); },\n    rel(iso) {\n      const t = Date.parse(iso); if (isNaN(t)) return '—';\n      const s = Math.max(0, Math.floor((this.tick - t) / 1000));\n      if (s < 60) return 'just now';\n      const m = Math.floor(s / 60); if (m < 60) return m + (m === 1 ? ' min ago' : ' mins ago');\n      const h = Math.floor(m / 60); return h + (h === 1 ? ' hr ago' : ' hrs ago');\n    }\n  }\n};\n</script>\n\n<style>\n@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@700;800&family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&display=swap');\n.hfc-oa { --ink:#16201f; --ink-mid:#445159; --ink-dim:#6d7a80; --line:#d5d1c4; --line-soft:#e0ddd2; --surface:#fbfaf6; --accent-ink:#9a5a0a; --green:#2f9e44; --err:#c0392b;\n  font-family:\"IBM Plex Sans\", system-ui, sans-serif; color:var(--ink); width:100%; }\n.hfc-oa-head { display:flex; align-items:center; gap:.75rem; margin:.25rem 0 1rem; }\n.hfc-oa-head img { border-radius:7px; }\n.hfc-oa-eyebrow { font-family:\"IBM Plex Mono\", monospace; font-size:.68rem; letter-spacing:.16em; text-transform:uppercase; color:var(--accent-ink); }\n.hfc-oa-title { font-family:\"Archivo\", sans-serif; font-weight:800; font-size:1.5rem; line-height:1.15; color:var(--ink); }\n.hfc-oa-status { font-family:\"IBM Plex Mono\", monospace; font-size:.78rem; color:var(--ink-dim); letter-spacing:.03em; display:flex; align-items:center; gap:.6rem; margin:0 0 1rem; }\n.hfc-oa-dot { width:8px; height:8px; border-radius:50%; background:var(--green); box-shadow:0 0 7px 0 rgba(47,158,68,.65); flex:none; }\n.hfc-oa-dot.off { background:var(--err); box-shadow:0 0 7px 0 rgba(192,57,43,.65); }\n.hfc-oa-wrap { border:1px solid var(--line); border-radius:16px; overflow-x:auto; background:var(--surface); box-shadow:0 1px 2px rgba(20,25,25,.06), 0 18px 40px -24px rgba(20,25,25,.35); }\n.hfc-oa-table { width:100%; border-collapse:collapse; }\n.hfc-oa-table th, .hfc-oa-table td { text-align:left; padding:.85rem 1rem; border-bottom:1px solid var(--line-soft); vertical-align:middle; }\n.hfc-oa-table thead th { font-family:\"IBM Plex Mono\", monospace; font-size:.64rem; font-weight:500; letter-spacing:.12em; text-transform:uppercase; color:var(--ink-dim); }\n.hfc-oa-table tbody tr:last-child td { border-bottom:0; }\n.hfc-oa-table .call { font-family:\"Archivo\", sans-serif; font-weight:700; font-size:1.05rem; letter-spacing:.02em; white-space:nowrap; }\n.hfc-oa-table .call span { vertical-align:middle; }\n.hfc-oa-table .flag { width:20px; height:14px; object-fit:cover; border-radius:2px; box-shadow:0 0 0 1px rgba(0,0,0,.15); margin-right:.5rem; vertical-align:middle; }\n.hfc-oa-table .freq { font-family:\"IBM Plex Mono\", monospace; color:var(--accent-ink); font-size:1rem; white-space:nowrap; }\n.hfc-oa-table .freq small { color:var(--ink-dim); font-size:.62rem; letter-spacing:.08em; }\n.hfc-oa-table .freq.cf { background:#14264B; color:#fff; }\n.hfc-oa-table .freq.cf small { color:rgba(255,255,255,.75); }\n.hfc-oa-table .mono { font-family:\"IBM Plex Mono\", monospace; font-size:.85rem; color:var(--ink-mid); }\n.hfc-oa-table .seen { font-family:\"IBM Plex Mono\", monospace; font-size:.78rem; color:var(--ink-dim); white-space:nowrap; }\n.hfc-oa-table .empty { padding:2.5rem 1rem; text-align:center; color:var(--ink-mid); }\n.hfc-oa-note { font-family:\"IBM Plex Mono\", monospace; font-size:.72rem; color:var(--ink-dim); margin:1rem 0 0; letter-spacing:.02em; }\n.hfc-oa-note a { color:var(--accent-ink); }\n@media (max-width:640px) { .hfc-oa-table .hide-sm { display:none; } .hfc-oa-table th, .hfc-oa-table td { padding:.65rem .55rem; } .hfc-oa-table .call { font-size:.95rem; } .hfc-oa-table .freq { font-size:.9rem; } .hfc-oa-table .flag { margin-right:.35rem; } .hfc-oa-title { font-size:1.25rem; } }\n</style>\n",
    "storeOutMessages": true,
    "passthru": false,
    "resendOnRefresh": true,
    "templateScope": "local",
    "className": "",
    "x": 700,
    "y": 80,
    "wires": [
      []
    ]
  },
  {
    "id": "hfc_c2",
    "type": "comment",
    "z": "hfc_onair_tab",
    "name": "Alerts: mute check, then Pushover (optional) and the 'HFC alerts' link for any other notifier",
    "info": "",
    "x": 380,
    "y": 200,
    "wires": []
  },
  {
    "id": "hfc_mute_gate",
    "type": "function",
    "z": "hfc_onair_tab",
    "name": "mute check",
    "func": "const until = flow.get('hfc_mute_until') || 0;\nif (until > Date.now()) { node.status({ text: 'muted: dropped ' + msg.topic }); return null; }\nnode.status({});\nreturn msg;\n",
    "outputs": 1,
    "timeout": 0,
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "info": "",
    "x": 150,
    "y": 260,
    "wires": [
      [
        "hfc_po_build",
        "hfc_link_out"
      ]
    ]
  },
  {
    "id": "hfc_po_build",
    "type": "function",
    "z": "hfc_onair_tab",
    "name": "Pushover message",
    "func": "const token = env.get('PUSHOVER_TOKEN'), user = env.get('PUSHOVER_USER');\nif (!token || !user) { node.status({ fill: 'grey', shape: 'ring', text: 'Pushover not set up' }); return null; }\nmsg.headers = { 'Content-Type': 'application/json' };\nmsg.payload = {\n    token, user,\n    title: msg.topic,\n    message: msg.payload,\n    sound: env.get('PUSHOVER_SOUND') || 'pushover',\n    url: 'https://mw0gbq.hamserve.uk/presence/',\n    url_title: 'Open On the Air'\n};\nreturn msg;\n",
    "outputs": 1,
    "timeout": 0,
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "info": "",
    "x": 360,
    "y": 260,
    "wires": [
      [
        "hfc_po_send"
      ]
    ]
  },
  {
    "id": "hfc_po_send",
    "type": "http request",
    "z": "hfc_onair_tab",
    "name": "POST Pushover",
    "method": "POST",
    "ret": "obj",
    "paytoqs": "ignore",
    "url": "https://api.pushover.net/1/messages.json",
    "tls": "",
    "persist": false,
    "proxy": "",
    "insecureHTTPParser": false,
    "authType": "",
    "senderr": false,
    "headers": [],
    "x": 560,
    "y": 260,
    "wires": [
      [
        "hfc_po_check"
      ]
    ]
  },
  {
    "id": "hfc_po_check",
    "type": "function",
    "z": "hfc_onair_tab",
    "name": "check result",
    "func": "if (msg.statusCode === 200 && msg.payload && msg.payload.status === 1) {\n    node.status({ fill: 'green', shape: 'dot', text: 'sent ' + new Date().toTimeString().slice(0, 5) });\n} else {\n    const err = (msg.payload && msg.payload.errors) ? msg.payload.errors.join('; ')\n              : (msg.statusCode ? 'HTTP ' + msg.statusCode : 'couldn\\'t reach api.pushover.net');\n    node.status({ fill: 'red', shape: 'ring', text: 'Pushover: ' + err });\n    node.warn('Pushover rejected the alert: ' + err + '. Check PUSHOVER_TOKEN (app token, starts with a) and PUSHOVER_USER (user key, starts with u).');\n}\nreturn null;\n",
    "outputs": 1,
    "timeout": 0,
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "info": "",
    "x": 740,
    "y": 260,
    "wires": [
      []
    ]
  },
  {
    "id": "hfc_link_out",
    "type": "link out",
    "z": "hfc_onair_tab",
    "name": "HFC alerts",
    "mode": "link",
    "links": [],
    "x": 335,
    "y": 310,
    "wires": []
  },
  {
    "id": "hfc_c3",
    "type": "comment",
    "z": "hfc_onair_tab",
    "name": "Wire a 'link in' to 'HFC alerts' for Telegram, ntfy, email…",
    "info": "Each alert arrives with msg.topic (title), msg.payload (body) and msg.spot (the full spot).",
    "x": 620,
    "y": 310,
    "wires": []
  },
  {
    "id": "hfc_c4",
    "type": "comment",
    "z": "hfc_onair_tab",
    "name": "Mute alerts from the dashboard: switch = until unmuted, button = 1 hour",
    "info": "",
    "x": 330,
    "y": 400,
    "wires": []
  },
  {
    "id": "hfc_sw",
    "type": "ui-switch",
    "z": "hfc_onair_tab",
    "group": "hfc_g_alerts",
    "name": "Mute alerts",
    "label": "Mute alerts",
    "order": 2,
    "width": "6",
    "height": "1",
    "passthru": false,
    "decouple": "false",
    "topic": "mute",
    "topicType": "str",
    "style": "",
    "className": "",
    "layout": "row-spread",
    "clickableArea": "switch",
    "onvalue": "true",
    "onvalueType": "bool",
    "onicon": "",
    "oncolor": "",
    "offvalue": "false",
    "offvalueType": "bool",
    "officon": "",
    "offcolor": "",
    "x": 130,
    "y": 460,
    "wires": [
      [
        "hfc_mute_ctrl"
      ]
    ]
  },
  {
    "id": "hfc_btn",
    "type": "ui-button",
    "z": "hfc_onair_tab",
    "group": "hfc_g_alerts",
    "name": "Mute 1 hour",
    "label": "Mute 1 hour",
    "order": 3,
    "width": "3",
    "height": "1",
    "emulateClick": false,
    "tooltip": "",
    "color": "",
    "bgcolor": "",
    "className": "",
    "icon": "",
    "iconPosition": "left",
    "payload": "mute 60",
    "payloadType": "str",
    "topic": "topic",
    "topicType": "msg",
    "buttonColor": "",
    "textColor": "",
    "iconColor": "",
    "enableClick": true,
    "enablePointerdown": false,
    "pointerdownPayload": "",
    "pointerdownPayloadType": "str",
    "enablePointerup": false,
    "pointerupPayload": "",
    "pointerupPayloadType": "str",
    "x": 130,
    "y": 500,
    "wires": [
      [
        "hfc_mute_ctrl"
      ]
    ]
  },
  {
    "id": "hfc_mute_ctrl",
    "type": "function",
    "z": "hfc_onair_tab",
    "name": "mute control",
    "func": "// switch: payload true/false · button: payload 'mute 60'\nlet mins = 0, on;\nif (typeof msg.payload === 'boolean') on = msg.payload;\nelse { const p = String(msg.payload).trim().split(/\\s+/); on = p[0] !== 'unmute'; mins = parseInt(p[1]) || 0; }\nflow.set('hfc_mute_until', on ? (mins ? Date.now() + mins * 60000 : Number.MAX_SAFE_INTEGER) : 0);\nreturn { payload: 'refresh' };\n",
    "outputs": 1,
    "timeout": 0,
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "info": "",
    "x": 330,
    "y": 480,
    "wires": [
      [
        "hfc_mute_state"
      ]
    ]
  },
  {
    "id": "hfc_mute_tick",
    "type": "inject",
    "z": "hfc_onair_tab",
    "name": "every 60 s",
    "props": [
      {
        "p": "payload"
      }
    ],
    "repeat": "60",
    "crontab": "",
    "once": true,
    "onceDelay": "2",
    "topic": "",
    "payload": "",
    "payloadType": "date",
    "x": 330,
    "y": 540,
    "wires": [
      [
        "hfc_mute_state"
      ]
    ]
  },
  {
    "id": "hfc_mute_state",
    "type": "function",
    "z": "hfc_onair_tab",
    "name": "mute state",
    "func": "// Output 1 -> switch, 2 -> status text\nlet until = flow.get('hfc_mute_until') || 0;\nconst now = Date.now();\nif (until && until <= now) { flow.set('hfc_mute_until', 0); until = 0; }\nlet txt = 'Alerts are on';\nif (until === Number.MAX_SAFE_INTEGER) txt = 'Alerts muted until you switch them back on';\nelse if (until) txt = 'Alerts muted for ' + Math.ceil((until - now) / 60000) + ' more min';\nnode.status({ fill: until ? 'yellow' : 'green', shape: 'dot', text: txt });\nreturn [{ payload: !!until }, { payload: txt }];\n",
    "outputs": 2,
    "timeout": 0,
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "info": "",
    "x": 530,
    "y": 500,
    "wires": [
      [
        "hfc_sw"
      ],
      [
        "hfc_mute_txt"
      ]
    ]
  },
  {
    "id": "hfc_mute_txt",
    "type": "ui-text",
    "z": "hfc_onair_tab",
    "group": "hfc_g_alerts",
    "order": 1,
    "width": 0,
    "height": 0,
    "name": "Mute status",
    "label": "",
    "format": "{{msg.payload}}",
    "layout": "row-left",
    "style": false,
    "font": "",
    "fontSize": 16,
    "color": "#717171",
    "className": "",
    "x": 730,
    "y": 500,
    "wires": []
  }
]