Foobot: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | ## Lazarus and the Foobot air quality monitor | |
| 2 | 2 | ||
| 3 | 3 | - Foobot(http://foobot.io/) is an InternetOfThings gadget that monitors indoor air quality | |
| 4 | 4 | - Unfortunately, the company currently only supplies mobile phone apps to access the Foobot | |
| 5 | 5 | - They do however publish an API which returns JSON data when queried, so I decided to port it to the PC using Lazarus and FPC | |
| 6 | 6 | - The API page is here: <https://api.foobot.io/apidoc/index.html> | |
| 7 | 7 | ||
| 8 | 8 | ### Screenshots | |
| 9 | 9 | ||
| 10 | 10 | - Foobot Monitor | |
| 11 | 11 | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 12 | + |  | |
| 16 | 13 | ||
| 17 | 14 | - Foobot monitor configuration window | |
| 18 | 15 | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - | ||
| 16 | + |  | |
| 23 | 17 | ||
| 24 | 18 | - Foobot Interrogator | |
| 25 | 19 | ||
| 26 | 20 | \ | |
| 27 | 21 |  | |
| 28 | 22 | ||
| 29 | 23 | ### What you will need | |
| 30 | 24 | ||
| 31 | 25 | 1\. A Foobot\ | |
| 32 | 26 | 2\. A Foobot account\ | |
| 33 | 27 | 3\. A free API Key (get one from the API page: <https://api.foobot.io/apidoc/index.html>) | |
| 34 | 28 | ||
| 35 | 29 | ### Binary Downloads: Foobot Monitor | |
| 36 | 30 | ||
| 37 | 31 | Windows 32/64 binaries:\ | |
| 38 | 32 | <https://svn.code.sf.net/p/lazarus-ccr/svn/applications/foobot/monitor/innosetup/setup_foobotmonitor.exe>\ | |
| 39 | 33 | Linux 32/64 binaries:\ | |
| 40 | 34 | <https://svn.code.sf.net/p/lazarus-ccr/svn/applications/foobot/monitor/linuxbinaries/foobotmonitor.zip> | |
| 41 | 35 | ||
| 42 | 36 | ### Binary Downloads: Foobot Interrogator | |
| 43 | 37 | ||
| 44 | 38 | Windows 32/64 binaries:\ | |
| 45 | 39 | <https://svn.code.sf.net/p/lazarus-ccr/svn/applications/foobot/innosetup/foobotinterrogator_setup.exe>\ | |
| 46 | 40 | Linux 32/64 binaries:\ | |
| 47 | 41 | <https://svn.code.sf.net/p/lazarus-ccr/svn/applications/foobot/compiled/linuxbinaries.zip>) | |
| 48 | 42 | ||
| 49 | 43 | ### Source | |
| 50 | 44 | ||
| 51 | 45 | Source code is in Lazarus CCR here: <https://svn.code.sf.net/p/lazarus-ccr/svn/applications/foobot/> | |
| 52 | 46 | ||
| 53 | 47 | #### Functions | |
| 54 | 48 | ||
| 55 | 49 | There are two main functions in foobot_utility.pas for you to use. Both will populate TObjects in foobot_objects.pas which you can read. | |
| 56 | 50 | ||
| 57 | 51 | ``` pascal | |
| 58 | 52 | // Populates FoobotIdentityObject.TFoobotIdentityList collection | |
| 59 | 53 | function FetchFoobotIdentity(aUsername, aSecretKey: string): boolean; | |
| 60 | 54 | ||
| 61 | 55 | // Populates FoobotDataObject | |
| 62 | 56 | function FetchFoobotData(DataFetchType: TDataFetchType = dfLast; | |
| 63 | 57 | iCurrentFoobot: integer = 0; iLastIntervalSeconds: integer = 3600; | |
| 64 | 58 | iLastAverageBySeconds: integer = 0; iStartTimeSeconds: int64 = 0; | |
| 65 | 59 | iEndTimeSeconds: int64 = 0; aSecretKey: string = 'unknown'): boolean; | |
| 66 | 60 | ||
| 67 | 61 | // Populates datapoint arrays from FoobotIdentityObject for easy access | |
| 68 | 62 | // - also populates HighLow arrays | |
| 69 | 63 | function FoobotDataObjectToArrays: boolean; | |
| 70 | 64 | ``` | |
| 71 | 65 | ||
| 72 | 66 | ### Security | |
| 73 | 67 | ||
| 74 | 68 | - When first run Foobot Monitor will prompt you to enter your Foobot Username and an API Key. | |
| 75 | 69 | - These values are then stored in an encrypted configuration file so that they will load automatically in future | |
| 76 | 70 | - The configurarion file is located: | |
| 77 | 71 | - Windows: %APPDATA%\username\Local\foobotmonitor\\ | |
| 78 | 72 | - Linux /home/.config | |
| 79 | 73 | - You can alter/update the stored login data in the following way: | |
| 80 | 74 | ||
| 81 | 75 | 1\. Open the foobotmonitor.cfg file\ | |
| 82 | 76 | 2\. Make a new entry thus, then save the file. (using your values instead of the example \<..\> ones) | |
| 83 | 77 | ||
| 84 | 78 | ``` pascal | |
| 85 | 79 | [Config] | |
| 86 | 80 | Foobot User=<username> | |
| 87 | 81 | Secret Key=<Secret API Key> | |
| 88 | 82 | ``` | |
| 89 | 83 | ||
| 90 | 84 | - Next time Foobot Monitor is run, these values are read, then encrypted and the plaintext is deleted | |
| 91 | 85 | - You can do this as many times as you like | |
| 92 | 86 | ||
| 93 | 87 | ### Licence | |
| 94 | 88 | ||
| 95 | 89 | License is GPLV2 (https://en.wikipedia.org/wiki/GNU_General_Public_License) | |
| 96 | 90 | ||
| 97 | 91 | ### Updates | |
| 98 | 92 | ||
| 99 | 93 | - From V0.1.1.0 you can configure the colours, Max and Min values for all the sensor displays. | |
| 100 | 94 | - The configurarion file is located: | |
| 101 | 95 | - Windows: %APPDATA%\username\Local\foobotmonitor\\ | |
| 102 | 96 | - Linux /home/.config | |
| 103 | 97 | - You can alter/update the colors and Max/Min values in the following way: | |
| 104 | 98 | ||
| 105 | 99 | 1\. Open the foobotmonitor.cfg file\ | |
| 106 | 100 | 2\. Edit the \[Config\] section | |
| 107 | 101 | ||
| 108 | 102 | ``` pascal | |
| 109 | 103 | [Config] | |
| 110 | 104 | pmColour=clGreen | |
| 111 | 105 | tmpColour=clRed | |
| 112 | 106 | humColour=clMaroon | |
| 113 | 107 | co2Colour=clLime | |
| 114 | 108 | vocColour=clBlue | |
| 115 | 109 | allpolluColour=clFuchsia | |
| 116 | 110 | pmMinValue=0 | |
| 117 | 111 | pmMaxValue=1000 | |
| 118 | 112 | tmpMinValue=0 | |
| 119 | 113 | tmpMaxValue=40 | |
| 120 | 114 | humMinValue=10 | |
| 121 | 115 | humMaxValue=100 | |
| 122 | 116 | co2MinValue=450 | |
| 123 | 117 | co2MaxValue=3000 | |
| 124 | 118 | vocMinValue=125 | |
| 125 | 119 | vocMaxValue=1000 | |
| 126 | 120 | allpolluMinValue=0 | |
| 127 | 121 | allpolluMaxValue=700 | |
| 128 | 122 | DisplayYellowLines=0 | |
| 129 | 123 | DisplayRedLines=1 | |
| 130 | 124 | ``` | |
| 131 | 125 | ||
| 132 | 126 | Minesadorada | |
| 133 | 127 | ||
| 134 | 128 | --- | |
| 135 | 129 | *From the Free Pascal wiki, page "Foobot", as it stood on 2019-08-30 after a change by Minesadorada, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 136 | 130 | Category: Applications created with Lazarus |
