Thursday, February 2, 2023

Node-RED resources

Node-RED resources

Node-RED is a tool for easily connecting devices, APIs, and online services to automate tasks, create dashboards, and control your environment.


Background

A little background will help you understand the concepts being used in Node-RED and automation in general.

Node-RED

Node-RED is a drag-and-drop based programming tool, originally developed as a side project in 2013 by Nick O’Leary and Dave Conway-Jones of IBM’s Emerging Technology Services group and it is now a part of the OpenJS Foundation.

You create Node-RED programs by dragging different "nodes" from a palette of available functions and then connect these nodes together. Each node has a well defined purpose; it does something with it's input and passes the result onto the next node(s) in the program.

Node-RED started out as a tool for visualizing and manipulating mapping between MQTT topics. It has grown far beyond that in the decade or so since it was invented. You can read more about Node-RED if you are interested.

MQTT

MQTT (Message Queuing Telemetry Transport) was created by Dr. Andy Stanford-Clark and Arlen Nipper in 1999. The original purpose for MQTT was to allow remote monitoring devices used in the oil and gas industry to send their data to servers over expensive satellite connections.

MQTT is a lightweight machine-to-machine (M2M) messaging protocol for clients that are resource constrained (need a small code and data footprint) and are connected to unreliable networks or networks with limited or expensive bandwidth resources.


MQTT use a pub-sub (publish / subscribe) architecture. There are two basic components, clients and brokers. Clients connect to brokers and can publish data, subscribe to topics, or both.

MQTT messages contain a topic and a payload. Both the topic and payload are application defined.

The topic describes what the data is in a hierarchical format, like the directory structure on a computer.  The '/' character is used to separate each level. Some examples might be home/livingroom/temperaturegarage/temperature, or cabin/bedroom/humidity.

The payload is the data. Since the payload is application defined it could be an image from a camera, a sensor value (temperature, humidity, brightness level, on, off, etc.), a command ('on', 'off', 'dim', 'bright', etc.), or a collection of information (name: 'Jenny', phone: '888-867-5309', email: 'jenny@example.com'), audio data, and so on. Anything that can be digitized can be sent as a payload in MQTT.

This ~5 minute video will give you a brief intro to MQTT if you want to know more.





MQTT Broker (Mosquitto)

Mosquitto is an open source MQTT broker. Versions are available for a variety of platforms (windows, mac, linux, raspberry pi, etc.). They also host a test instance of their broker that you can use to test clients or just to get familiar with MQTT. They also have clients available for different platforms so you can subscribe to topics or publish messages.


RTL-SDR Software defined radios

More and more utilities are moving to "smart meters" that allow reading information without having to physically access the meter. Orem city just moved to smart water meters last year. And Rocky Mountain Power has been using smart power meters for several years.

The rtl-sdr.com site has a number of tools for reading and decoding data from smart meters, tire pressure sensors in cars, weather sensors and a host of other RF devices. It's a simple matter to start reading and recording your power or water usage.

Water readings

Orem's water meters are easy to read via the rtlamr tool using the SCM+ protocol. You just need to open your meter box and look for the number printed in very large text on the side of your device. Put that number into the following command in place of xxxxx and you'll start seeing data within a minute or two.

rtlamr -format json -msgtype scm+ -filterid xxxxx -agcmode true 

The meter transmits data once a minute. Depending on the location of your antenna you may get all the messages or only a few of them. Note that even though it sends a message once a minute, the actual meter reading is only updated hourly (unfortunately). Also, the meter reading appears to be in 10ths of a gallon. In other words a value of 10 represents one gallon, not ten gallons.

Power readings

Reading your power meter should work very similarly using the rtlamr tool. I have a net meter so I don't have any direct experience here unfortunately (see caveat below). At the top of the power meter, above the display, is a sticker with some FCC info on it and a big long number. That's the device ID you need to filter on.

I tried reading a meter on a local utility pedestal. I can see the meter and get readings from it in rtlamr, but the readings don't seem to change. Over a three day period, the "consumption" value remained constant even though the actual display on the meter changed.

One caveat - Rocky Mountain Power seems to have moved their customers with rooftop solar to the new Itron Gen5 Riva meters. These seem to be configured in 2.4GHz mesh mode so you can no longer read the data with the usual rtlamr 900MHz tools. This seems to only apply to net metering solar customers, not non-solar customers.


Resources


Basics

The main Node-RED site: https://nodered.org
Node-RED Flows
Node-RED for amateur radio group: nodered-hamradio groups.io
Mosquitto MQTT broker: https://mosquitto.org/download/


RTL-SDR - Software defined radio

RTL-SDR software defined radio news and projects https://www.rtl-sdr.com/
Quick guide to setup a RTL SDR Server on a Raspberry Pi. https://github.com/c4software/raspberry-rtlsdr-server


International space station

🛰 International Space Station announcement when it is about to be overhead (and visible!)


Additional information


Flows

You can copy and "import" these to your node-RED instance. Hit the hamburger menu on the top right, then select "import" from the menu. Copy and paste the text below (without the title) into the box & hit import.


Air quality flow

[{"id":"7d0550b4d1c16c24","type":"inject","z":"28053dfef12b07e3","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":100,"wires":[["b64ff284222e38f2"]]},{"id":"b64ff284222e38f2","type":"http request","z":"28053dfef12b07e3","name":"AQI Lindon","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://air.utah.gov/csvFeed.php?id=ln","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":310,"y":100,"wires":[["d79841da3c713e8b"]]},{"id":"0cb95d9d5e681a42","type":"debug","z":"28053dfef12b07e3","name":"AQI debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":470,"y":40,"wires":[]},{"id":"d79841da3c713e8b","type":"csv","z":"28053dfef12b07e3","name":"Parse CSV","sep":"\\t","hdrin":true,"hdrout":"none","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":490,"y":100,"wires":[["91791c876ea24429"]]},{"id":"91791c876ea24429","type":"change","z":"28053dfef12b07e3","name":"Latest","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":130,"y":180,"wires":[["e75db06bac7d35b1","0cb95d9d5e681a42"]]},{"id":"e75db06bac7d35b1","type":"split","z":"28053dfef12b07e3","name":"Split object","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"topic","x":290,"y":180,"wires":[["acdc02d4916b47b1"]]},{"id":"428713f7463a26d0","type":"comment","z":"28053dfef12b07e3","name":"AQI information","info":"Data from https://air.utah.gov/airapi.html\n\n\nAccording to https://air.utah.gov/ the\nfollowing ranges are applicable\n\n| AQI    | PM 2.5     | Ozone       |\n Good      0-12         0-0.054\n Moderate  12.1-35.4    0.055-0.070\n Sensitive 35.5-55.4    0.071-0.085\n Unhealthy 55.5-150.4   0.086-0.105\n Very bad  150.5-250.4  0.106-0.200\n Hazardous 250.5+       0.201+\n \n PM2.5 is in ug/m3 and based on a 24 hour average\n Ozone is in ppm and based on an 8 hour average\n\n NO2 levels from EPA\n https://www.airnow.gov/sites/default/files/2018-06/no2.pdf\n\nPPB (state reports PPM)\nGood 0-50\nModerate 51-100\nSensitive 101-150\nUnhealth 151-200\nVery bad 201-300\n","x":140,"y":40,"wires":[]},{"id":"acdc02d4916b47b1","type":"switch","z":"28053dfef12b07e3","name":"Route messages","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"dtstamp","vt":"str"},{"t":"eq","v":"ozone","vt":"str"},{"t":"eq","v":"ozone_8hr_avg","vt":"str"},{"t":"eq","v":"pm25","vt":"str"},{"t":"eq","v":"pm25_24hr_avg","vt":"str"},{"t":"eq","v":"no2","vt":"str"},{"t":"eq","v":"co","vt":"str"},{"t":"eq","v":"temp","vt":"str"},{"t":"eq","v":"rh","vt":"str"},{"t":"eq","v":"ws","vt":"str"},{"t":"eq","v":"wd","vt":"str"},{"t":"eq","v":"sr","vt":"str"}],"checkall":"true","repair":false,"outputs":12,"x":170,"y":360,"wires":[["13a54c24be136349"],["c04efbac895729f3","2dfac0064328f31a"],["2dfac0064328f31a"],["d6162e12d5bf363b","73bb8cc649668118"],["73bb8cc649668118"],["fddc52cea250d9b6","d5b05f209645a903"],["90e52970c8438acc","1351cc1cf525fa04"],["9817090a6398563a","77f2c5f9b0041a8b"],["cfbd698e4fc69cbf","5784aae85b3353f1"],["9d44a12ce2fb9447"],["e93c3b9d67b7542f"],["1ebb09c7ebb423fd","3f1c7077656ad8b9"]],"inputLabels":["AQI messages"],"outputLabels":["dtstamp","ozone","ozone_8hr_avg","pm25","pm25_24hr_avg","no2","co","temp","rh","ws","wd","sr"]},{"id":"13a54c24be136349","type":"ui_text","z":"28053dfef12b07e3","group":"f178535d7c428ccf","order":1,"width":0,"height":0,"name":"time","label":"Time","format":"{{msg.payload}}","layout":"row-left","className":"","x":570,"y":200,"wires":[]},{"id":"c04efbac895729f3","type":"ui_gauge","z":"28053dfef12b07e3","name":"Ozone","group":"f178535d7c428ccf","order":2,"width":"3","height":"3","gtype":"gage","title":"Ozone","label":"PPM","format":"{{value}}","min":0,"max":"0.2","colors":["#00b500","#e6e600","#ca3838"],"seg1":"0.055","seg2":"0.086","diff":false,"className":"","x":570,"y":240,"wires":[]},{"id":"2dfac0064328f31a","type":"ui_chart","z":"28053dfef12b07e3","name":"Ozone","group":"f178535d7c428ccf","order":3,"width":"3","height":"3","label":"Ozone","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"12","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":690,"y":260,"wires":[[]]},{"id":"d6162e12d5bf363b","type":"ui_gauge","z":"28053dfef12b07e3","name":"PM2.5","group":"f178535d7c428ccf","order":4,"width":"3","height":"3","gtype":"gage","title":"PM2.5","label":"ug/m3","format":"{{value}}","min":0,"max":"250","colors":["#00b500","#e6e600","#ca3838"],"seg1":"12","seg2":"55.5","diff":false,"className":"","x":570,"y":280,"wires":[]},{"id":"73bb8cc649668118","type":"ui_chart","z":"28053dfef12b07e3","name":"PM2.5","group":"f178535d7c428ccf","order":5,"width":"3","height":"3","label":"PM2.5","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"12","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":690,"y":300,"wires":[[]]},{"id":"fddc52cea250d9b6","type":"ui_gauge","z":"28053dfef12b07e3","name":"NO2","group":"f178535d7c428ccf","order":6,"width":"3","height":"3","gtype":"gage","title":"NO2","label":"PPM","format":"{{value}}","min":0,"max":"0.3","colors":["#00b500","#e6e600","#ca3838"],"seg1":"0.051","seg2":"0.151","diff":false,"className":"","x":570,"y":320,"wires":[]},{"id":"d5b05f209645a903","type":"ui_chart","z":"28053dfef12b07e3","name":"NO2","group":"f178535d7c428ccf","order":7,"width":"3","height":"3","label":"NO2","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"12","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":690,"y":340,"wires":[[]]},{"id":"9817090a6398563a","type":"ui_gauge","z":"28053dfef12b07e3","name":"Temp","group":"2d8b6f8f77619143","order":1,"width":"3","height":"3","gtype":"gage","title":"Temp","label":"F","format":"{{value}}","min":"-10","max":"110","colors":["#00ffee","#00eb1b","#ca3838"],"seg1":"60","seg2":"90","diff":false,"className":"","x":570,"y":440,"wires":[]},{"id":"77f2c5f9b0041a8b","type":"ui_chart","z":"28053dfef12b07e3","name":"Temp","group":"2d8b6f8f77619143","order":2,"width":"3","height":"3","label":"Temp","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"12","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":690,"y":460,"wires":[[]]},{"id":"cfbd698e4fc69cbf","type":"ui_gauge","z":"28053dfef12b07e3","name":"Humid","group":"2d8b6f8f77619143","order":3,"width":"3","height":"3","gtype":"gage","title":"Humid","label":"%rh","format":"{{value}}","min":"0","max":"100","colors":["#00ff2a","#fbff00","#ca3838"],"seg1":"30","seg2":"50","diff":false,"className":"","x":570,"y":480,"wires":[]},{"id":"5784aae85b3353f1","type":"ui_chart","z":"28053dfef12b07e3","name":"Humid","group":"2d8b6f8f77619143","order":4,"width":"3","height":"3","label":"Humid","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"12","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":690,"y":500,"wires":[[]]},{"id":"9d44a12ce2fb9447","type":"ui_gauge","z":"28053dfef12b07e3","name":"Wind","group":"2d8b6f8f77619143","order":5,"width":"3","height":"3","gtype":"gage","title":"Wind","label":"MPH","format":"{{value}}","min":"0","max":"75","colors":["#00ff2a","#fbff00","#ca3838"],"seg1":"30","seg2":"50","diff":false,"className":"","x":570,"y":520,"wires":[]},{"id":"e93c3b9d67b7542f","type":"ui_gauge","z":"28053dfef12b07e3","name":"Dir","group":"2d8b6f8f77619143","order":6,"width":"3","height":"3","gtype":"compass","title":"Dir","label":"","format":"{{value}}","min":"0","max":"75","colors":["#00ff2a","#fbff00","#ca3838"],"seg1":"30","seg2":"50","diff":false,"className":"","x":690,"y":540,"wires":[]},{"id":"90e52970c8438acc","type":"ui_gauge","z":"28053dfef12b07e3","name":"CO","group":"f178535d7c428ccf","order":8,"width":"3","height":"3","gtype":"gage","title":"CO","label":"PPM","format":"{{value}}","min":0,"max":"1","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":570,"y":360,"wires":[]},{"id":"1351cc1cf525fa04","type":"ui_chart","z":"28053dfef12b07e3","name":"CO","group":"f178535d7c428ccf","order":9,"width":"3","height":"3","label":"CO","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"12","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":690,"y":380,"wires":[[]]},{"id":"1ebb09c7ebb423fd","type":"ui_gauge","z":"28053dfef12b07e3","name":"Solar","group":"2d8b6f8f77619143","order":9,"width":"3","height":"3","gtype":"gage","title":"Solar","label":"w/m2","format":"{{value}}","min":"0","max":"500","colors":["#00ff2a","#fbff00","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":570,"y":560,"wires":[]},{"id":"3f1c7077656ad8b9","type":"ui_chart","z":"28053dfef12b07e3","name":"Solar","group":"2d8b6f8f77619143","order":10,"width":"3","height":"3","label":"Solar","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"12","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":690,"y":580,"wires":[[]]},{"id":"f178535d7c428ccf","type":"ui_group","name":"Lindon","tab":"9d16aed7861d445a","order":3,"disp":true,"width":"6","collapse":true,"className":""},{"id":"2d8b6f8f77619143","type":"ui_group","name":"Weather","tab":"9d16aed7861d445a","order":2,"disp":true,"width":"6","collapse":true,"className":""},{"id":"9d16aed7861d445a","type":"ui_tab","name":"Air Quality","icon":"wi-darksky-wind","order":1,"disabled":false,"hidden":false}]


ISS

[{"id":"1da6e3bdacaca0f9","type":"worldmap","z":"9a8c4b547b38e156","name":"ISS map","lat":"","lon":"","zoom":"3","layer":"EsriS","cluster":"","maxage":"90","usermenu":"show","layers":"show","panit":"true","panlock":"false","zoomlock":"false","hiderightclick":"true","coords":"utm","showgrid":"true","showruler":"true","allowFileDrop":"false","path":"/iss","overlist":"RA,DN,TL","maplist":"OSMG,OSMC,EsriS","mapname":"","mapurl":"","mapopt":"","mapwms":false,"x":300,"y":280,"wires":[]},{"id":"cd15dbc58a3a4e01","type":"http request","z":"9a8c4b547b38e156","name":"Get ISS position","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://api.open-notify.org/iss-now.json","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":300,"y":120,"wires":[["01020efb56ca3c3e"]]},{"id":"3fec0a7643a12c76","type":"inject","z":"9a8c4b547b38e156","name":"Every minute","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":120,"wires":[["cd15dbc58a3a4e01"]]},{"id":"01020efb56ca3c3e","type":"change","z":"9a8c4b547b38e156","name":"Convert to worldmap","rules":[{"t":"set","p":"payload.lat","pt":"msg","to":"payload.iss_position.latitude","tot":"msg"},{"t":"set","p":"payload.lon","pt":"msg","to":"payload.iss_position.longitude","tot":"msg"},{"t":"set","p":"payload.name","pt":"msg","to":"International Space Station","tot":"str"},{"t":"set","p":"payload.icon","pt":"msg","to":"iss","tot":"str"},{"t":"set","p":"payload.iconColor","pt":"msg","to":"red","tot":"str"},{"t":"set","p":"payload.label","pt":"msg","to":"ISS","tot":"str"},{"t":"set","p":"payload.layer","pt":"msg","to":"ISS","tot":"str"},{"t":"set","p":"payload.weblink","pt":"msg","to":"[{\"name\":\"Next pass\",\"url\":\"https://spotthestation.nasa.gov/sightings/view.cfm?country=United_States&region=Utah&city=Orem\",\"target\":\"_new\"},{\"name\":\"Mission info\",\"url\":\"https://www.nasa.gov/mission_pages/station/main/index.html\",\"target\":\"_new\"}]","tot":"json"},{"t":"delete","p":"payload.iss_position","pt":"msg"},{"t":"delete","p":"payload.message","pt":"msg"},{"t":"delete","p":"payload.timestamp","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":200,"wires":[["5cf81bf789afe7be","1da6e3bdacaca0f9"]]},{"id":"212a437e52c23cb1","type":"comment","z":"9a8c4b547b38e156","name":"ISS info & resources","info":"Next time ISS is overhead from NASA\nhttps://spotthestation.nasa.gov/sightings/view.cfm?country=United_States&region=Utah&city=Orem\n\nTracking the ISS with Node-RED on a Raspberry Pi\nhttps://pycrocoding.medium.com/tracking-the-iss-with-node-red-on-a-raspberry-pi-4-5a23d9362caa\n\nISS announcement when it is about to be overhead (and visible!)\nhttps://community.home-assistant.io/t/international-space-station-announcement-when-it-is-about-to-be-overhead-and-visible/397431\n","x":110,"y":40,"wires":[]},{"id":"5cf81bf789afe7be","type":"worldmap-tracks","z":"9a8c4b547b38e156","name":"ISS track","depth":"30","layer":"combined","smooth":true,"x":100,"y":280,"wires":[["1da6e3bdacaca0f9"]]}]


Ham DB lookup with map

[{"id":"5543b7dc63ef1bca","type":"ui_text_input","z":"134851ca88c24fe4","name":"Call sign","label":"Callsign","tooltip":"Enter the station call sign","group":"d9b5c411da0c8d24","order":0,"width":0,"height":0,"passthru":false,"mode":"text","delay":"0","topic":"callsign","sendOnBlur":false,"className":"","topicType":"str","x":100,"y":180,"wires":[["4dd7ff27f9fbf929","30acc081a38c741a"]]},{"id":"3d493dacd1cdafba","type":"http request","z":"134851ca88c24fe4","name":"hamdb lookup","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":480,"y":180,"wires":[["3c9e94c07a6eace1","379a1c3a2cb8c3ec"]]},{"id":"09d31ff412eb9d94","type":"worldmap","z":"134851ca88c24fe4","name":"Ham lookup","lat":"40.2605215","lon":"-111.7005643","zoom":"11","layer":"OSMC","cluster":"","maxage":"90","usermenu":"show","layers":"show","panit":"true","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"utm","showgrid":"true","showruler":"true","allowFileDrop":"false","path":"/ham","overlist":"RA,DN,TL","maplist":"OSMG,OSMC,EsriS","mapname":"","mapurl":"","mapopt":"","mapwms":false,"x":550,"y":380,"wires":[]},{"id":"95478a0270885a54","type":"change","z":"134851ca88c24fe4","name":"Convert to worldmap","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.hamdb.callsign","tot":"msg","dc":true},{"t":"set","p":"payload.label","pt":"msg","to":"payload.call","tot":"msg"},{"t":"set","p":"payload.name","pt":"msg","to":"$.payload.call & \": \" & $.payload.fname & \" \" & $.payload.mi & \" \" & $.payload.name & \" \" & $.payload.suffix","tot":"jsonata"},{"t":"set","p":"payload.icon","pt":"msg","to":"fa-user-circle-o","tot":"str"},{"t":"set","p":"payload.weblink","pt":"msg","to":"{\"name\":\"QRZ\",\"url\":\"http://www.qrz.com/db/\" & $.payload.call & \"/\",\"target\":\"_new\"}","tot":"jsonata"},{"t":"set","p":"payload.layer","pt":"msg","to":"hams","tot":"str"},{"t":"delete","p":"payload.fname","pt":"msg"},{"t":"delete","p":"payload.mi","pt":"msg"},{"t":"delete","p":"payload.suffix","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":300,"wires":[["09d31ff412eb9d94","23caf401.9d6d4c","7602a9da7abfc7d7"]]},{"id":"4dd7ff27f9fbf929","type":"template","z":"134851ca88c24fe4","name":"Convert to API","field":"url","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"http://api.hamdb.org/{{payload}}/json/uvarcdemo","output":"str","x":280,"y":180,"wires":[["3d493dacd1cdafba"]]},{"id":"379a1c3a2cb8c3ec","type":"change","z":"134851ca88c24fe4","name":"blank string","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":150,"y":60,"wires":[["0a7906eba955ab06"]]},{"id":"4deeb220be58cf5a","type":"ui_toast","z":"134851ca88c24fe4","position":"top right","displayTime":"3","highlight":"","sendall":true,"outputs":0,"ok":"OK","cancel":"","raw":false,"className":"","topic":"HamDB","name":"toast","x":750,"y":300,"wires":[]},{"id":"7602a9da7abfc7d7","type":"template","z":"134851ca88c24fe4","name":"Format toast","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.name}}","output":"str","x":570,"y":300,"wires":[["4deeb220be58cf5a"]]},{"id":"86b1f299b0b23707","type":"ui_template","z":"134851ca88c24fe4","group":"1671379f30926081","name":"hamqsl Band conditions","order":1,"width":"9","height":"4","format":"<center>\n    <a href=\"https://www.hamqsl.com/solar.html\"\n        title=\"Click to add Solar-Terrestrial Data to your website!\" target=\"_new\"><img src=\"https://www.hamqsl.com/solar101vhf.php\"></a>\n</center>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","className":"","x":330,"y":560,"wires":[[]]},{"id":"6a245d48aeabd4c3","type":"ui_template","z":"134851ca88c24fe4","group":"1671379f30926081","name":"RigRef Band conditions","order":2,"width":"9","height":"3","format":"<center><a href=\"https://rigreference.com/solar\"\n target=\"_blank\"><img src=\"https://rigreference.com/solar/img/wide\" border=\"0\"></a></center>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","className":"","x":330,"y":600,"wires":[[]]},{"id":"7db57965.76d468","type":"ui_button","z":"134851ca88c24fe4","name":"Open ISS tab","group":"93eb817c13fb862d","order":1,"width":"3","height":"1","passthru":true,"label":"ISS","tooltip":"Open the ISS tab","color":"","bgcolor":"","className":"","icon":"satellite","payload":"iss","payloadType":"str","topic":"change-tab","topicType":"str","x":360,"y":500,"wires":[["6d6a371c653a1e38"]]},{"id":"5e1f0081.6dc3c","type":"ui_template","z":"134851ca88c24fe4","group":"93eb817c13fb862d","name":"window redirect","order":3,"width":0,"height":0,"format":"<script>\n(function(scope) {\n    scope.$watch('msg.payload', function(data) {\n      if (data == \"empty\" || data == \"\" || data == \"0\" || data === undefined)\n        return;\n\n      window.open(\"http://localhost:1880/\" + data, data + \"_tab\");\n      /*\n      if (data == \"Node-RED\") {\n        window.open(\"https://www.nodered.org\", \"nodered_tab\");\n        //window.location.href = \"https://www.nodered.org\";\n      } \n      if (data == \"GitHub\") {\n        window.open(\"https://github.com/node-red\", \"github_tab\");\n        //window.location.href = \"https://github.com/node-red\";\n      } \n      */\n    });\n})(scope);\n</script>","storeOutMessages":false,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","className":"","x":720,"y":480,"wires":[[]]},{"id":"23caf401.9d6d4c","type":"ui_button","z":"134851ca88c24fe4","name":"Open ham tab","group":"93eb817c13fb862d","order":2,"width":"3","height":"1","passthru":true,"label":"Ham DB","tooltip":"Open the HAM DB tab","color":"","bgcolor":"","className":"","icon":"fa-id-card-o","payload":"ham","payloadType":"str","topic":"change-tab","topicType":"str","x":360,"y":460,"wires":[["6d6a371c653a1e38"]]},{"id":"6d6a371c653a1e38","type":"trigger","z":"134851ca88c24fe4","name":"reset","op1":"","op2":"","op1type":"pay","op2type":"str","duration":"250","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":550,"y":480,"wires":[["5e1f0081.6dc3c"]],"info":"This is necessary or the window code won't move to the same window twice in a row"},{"id":"3c9e94c07a6eace1","type":"switch","z":"134851ca88c24fe4","name":"Success or fail","property":"payload.hamdb.messages.status","propertyType":"msg","rules":[{"t":"eq","v":"OK","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":700,"y":180,"wires":[["95478a0270885a54"],["fc65050e80308d0a"]],"outputLabels":["success","fail"]},{"id":"fc65050e80308d0a","type":"change","z":"134851ca88c24fe4","name":"fail - show status","rules":[{"t":"set","p":"payload","pt":"msg","to":"$flowContext('callsign') & \" \" & $.payload.hamdb.messages.status","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":240,"wires":[["4deeb220be58cf5a"]]},{"id":"0a7906eba955ab06","type":"delay","z":"134851ca88c24fe4","name":"delay .25 sec","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":330,"y":60,"wires":[["5543b7dc63ef1bca"]]},{"id":"30acc081a38c741a","type":"change","z":"134851ca88c24fe4","name":"Save call sign","rules":[{"t":"set","p":"callsign","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":220,"wires":[[]]},{"id":"d9b5c411da0c8d24","type":"ui_group","name":"HamDB","tab":"5af3bc9c93f141e7","order":2,"disp":true,"width":"6","collapse":true,"className":""},{"id":"1671379f30926081","type":"ui_group","name":"Band conditions","tab":"5af3bc9c93f141e7","order":3,"disp":true,"width":"9","collapse":true,"className":""},{"id":"93eb817c13fb862d","type":"ui_group","name":"Default","tab":"5af3bc9c93f141e7","order":1,"disp":true,"width":"6","collapse":true,"className":""},{"id":"5af3bc9c93f141e7","type":"ui_tab","name":"Home","icon":"dashboard","order":2,"disabled":false,"hidden":false}]