Sign in Join
Wiki copytemporary

Foobot: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Foobot

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

Back to history