The plugin DS18B20 for DoT
Sets a pin in 1-Wire mode.
http://192.168.1.49/DS18B20.lua?init=4
Search for all 1-Wire device. Return the number of sensors found
http://192.168.1.49/DS18B20.lua?find=true
Attention! Before obtaining the temperature, if the sensors are not polled for a long time, you must first send the scan command
http://192.168.1.49/DS18B20.lua?scan=true
Getting the temperature of the first sensor found
http://192.168.1.49/DS18B20.lua?get=1
Get the temperature of all found sensors. Returns an object of data ( "124EAB300":"30.2500","FFF63116153":"32.5000","FFC73816153":"32.5625"} )
http://192.168.1.49/DS18B20.lua?get=0
or
pin = 4 -- gpio2
dofile("DS18B20.lua")({init=pin}) -- Sets a pin in 1-Wire mode.
print(dofile("DS18B20.lua")({find=true})) --Search for all 1-Wire device. Return the number of sensors found
-- dofile("DS18B20.lua")({scan=1}) -- Command to all devices for temperature conversion
print(dofile("DS18B20.lua")({get=1})) -- Getting the temperature of the first sensor found
r = dofile("DS18B20.lua")({get=0}) -- or get the temperature of all found sensors
for i, v in pairs(r) do
print(i.." : "..v)
end
Contributions are welcome.
The package is made up of 2 main folders:
- /src (Source files)
- /files (Compiled and compressed files)
To setup and run a local copy:
- Clone this repo with
git clone https://github.com/bondrogeen/DoT.DS18B20
- Run
npm install
in root folder
After installing the dependencies, you can start working with the sources.
- Run
gilp build
(Compile and compress files)
When you're done working on your changes, submit a PR with the details and include a screenshot if you've changed anything visually.
- (bondrogeen) fix mqtt.
- (bondrogeen) minor fix.
- (bondrogeen) init.