Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions usermods/PIR_sensor_switch/PIR_sensor_switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,12 @@ void PIRsensorSwitch::publishHomeAssistantAutodiscovery()
doc[F("uniq_id")] = uid;
doc[F("dev_cla")] = F("motion");
doc[F("exp_aft")] = 1800;

JsonObject device = doc.createNestedObject(F("device")); // attach the sensor to the same device
device[F("name")] = serverDescription;
device[F("ids")] = String(F("wled-sensor-")) + mqttClientID;
device[F("mf")] = F(WLED_BRAND);
device[F("mdl")] = F(WLED_PRODUCT_NAME);
device[F("sw")] = versionString;

sprintf_P(buf, PSTR("homeassistant/binary_sensor/%s/config"), uid);
DEBUG_PRINTLN(buf);
size_t payload_size = serializeJson(doc, json_str);
Expand Down
22 changes: 22 additions & 0 deletions usermods/adc_sensor_mqtt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ADC sensor with MQTT ## based on LDR_Dusk_Dawn_v2 usermod from [@jeffwdh](https://github.com/jeffwdh)
This usermod will obtain readings from adc pin. This is useful for ldr for example for exterior lighting situations where you want the lights to only be on when it is dark out. but this mod is designed for more hass application. it will publish auto discovery message to hass mqtt and attach the sensor to the wled integration automatically

# Installation
Add "adc_sensor_mqtt" to your platformio.ini environment's custom_usermods and build.

Example:
```
[env:adc_sensor_mqtt_esp32dev]
extends = env:esp32dev
custom_usermods = ${env:esp32dev.custom_usermods}
adc_sensor_mqtt # Enable LDR Dusk Dawn Usermod
```

# Usermod Settings
Setting | Description | Default
--- | --- | ---
Enabled | Enable/Disable the LDR functionality. | Disabled
Pin | The analog capable pin your LDR is connected to. | A0
update interval | update interval to read the analog pin ( in ms ) | 3000
inverted | invert readings based on your own hardware setup ( invert mapping analog to digital value to 0V = 100% or 3.3V = 100% ) | false
change threshould | the minimum limit to detect change and publish the value (in % ; float ; ex 0.8 ) . | 1.0
Loading