Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add DDF for b-parasite plant sensor #7972

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
10 changes: 10 additions & 0 deletions devices/b-parasite/0400_lightlevel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* global Attr, Item, R */

const v = Attr.val
const tholddark = R.item('config/tholddark').val
const tholdoffset = R.item('config/tholdoffset').val

Item.val = v
R.item('state/dark').val = v <= tholddark
R.item('state/daylight').val = v > tholddark + tholdoffset
R.item('state/lux').val = Math.round(Math.pow(10, (Math.max(0, Math.min(v, 60001)) - 1) / 10000))
Loading