Unverified Commit 6fb16994 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

README: nits; consistency with other NodeMCU drivers

parent 58339aed
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
# ESP8266 Lua/NodeMCU module for MAX44009 illuminance sensor
# ESP8266 Lua/NodeMCU module for MAX44009 illuminance sensors

This repository contains an ESP8266 NodeMCU Lua module (`max44009.lua`) as well
as MQTT / HomeAssistant / InfluxDB integration example (`init.lua`) for
**MAX44009** illuminance sensors.
**MAX44009** illuminance sensors connected via I²C.

## Dependencies

@@ -41,15 +41,16 @@ Copy **max44009.lua** to your NodeMCU board and set it up as follows.

```lua
max44009 = require("max44009")
i2c.setup(0, sda_pin, scl_pin, i2c.SLOW)
i2c.setup(0, 1, 2, i2c.SLOW)

-- can be called with up to 1 Hz
function some_timer_callback()
	local lx = max44009.read()
	if lx == nil then
	if lx ~= nil then
		-- lx : Illuminance as floating point value [lx]
	else
		print("MAX44009 error")
	else
		-- lx contains the illuminance. Note that it is a floating point value.
	end
end
```
@@ -60,7 +61,7 @@ end
To use it, you need to create a **config.lua** file with WiFI and MQTT settings:

```lua
station_cfg = {ssid = "foo", pwd = "bar"}
station_cfg = {ssid = "...", pwd = "..."}
mqtt_host = "..."
```

@@ -72,5 +73,5 @@ influx_url = "..."
influx_attr = "..."
```

Readings will be stored as `max44009[influx_attr] illuminance_lx=...`.
Readings will be stored as `max44009[influx_attr] illuminance_lx=%f`.
So, unless `influx_attr = ''`, it must start with a comma, e.g. `influx_attr = ',device=' .. device_id`.