Comments (1)
Thanks for posting this. My device has similar keys and functionality. The light sensitivity setting code above doesn't seem to do anything on my device, but I was able to set up a text sensor to display the light level as read by my device's light sensor, based on your ADC sensor. I used the day
, dusk
, evenfall
, evening
, and night
keys from the original config as voltage thresholds (apparently in mV), though I'm going to end up adjusting them for my own usage since my device's sensor is almost always in the shade.
text_sensor:
- platform: template
id: text_sensor_ambient
name: Ambient Light Sensor
sensor:
- platform: adc
pin: ADC3
id: adc_ambient
name: Ambient ADC Value
unit_of_measurement: "V"
state_class: "measurement"
# This `on_value` trigger will update the text sensor based on the voltage thresholds read from the original config
# in my device's case, they looked like this:
# "day": 0,
# "dusk": 200,
# "evenfall": 1500,
# "evening": 1800,
# "night": 2150,
on_value:
then:
- lambda: |-
if (x > 2.15) {
id(text_sensor_ambient).publish_state("Night");
}
else if (x > 1.8) {
id(text_sensor_ambient).publish_state("Evening");
}
else if (x > 1.5) {
id(text_sensor_ambient).publish_state("Evenfall");
}
else if (x > 0.2) {
id(text_sensor_ambient).publish_state("Dusk");
}
else {
id(text_sensor_ambient).publish_state("Day");
}
I then set my own "light sensitivity trigger" by adding the following condition to my on_press
that handles turning on the light when the PIR pin goes high. In my case, I only want it to turn on the light if it is sufficiently dark outside (basically "evening
" or darker):
binary_sensor:
- platform: gpio
pin: P6
name: PIR Sensor
id: binary_sensor_pir
device_class: motion
on_press:
if:
condition:
sensor.in_range:
id: adc_ambient
above: 1.8
then:
- light.turn_on: light_flood
Separate from this, my device has a PIR sensitivity setting that I think can be inferred from the configuration. I will create an issue to detail what I've found.
from upk2esphome.
Related Issues (7)
- Tuya device firmware read from WR3 can't be analyzed in UPK2ESPHome HOT 6
- Using Tuya API - subscription cloud development plan has expired.
- LSC - 3004200 WiFi Outdoor Dual Socket *Working Config* HOT 2
- device support HOT 7
- Working profile with calibrated power monitoring for BN-LINK BNC-60/U133TJ WiFi Heavy Duty smart plug
- WB3S Tuya 1 gang switch HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from upk2esphome.