diff options
author | Daniel Friesel <derf@finalrewind.org> | 2022-04-19 17:46:19 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2022-04-19 17:46:19 +0200 |
commit | 14c0657c42169d1953f3a7947a51a59c346616b9 (patch) | |
tree | ff5f70a9bb60ee2ef93e28adebc46f8a4d0fa67f /sds011.lua | |
parent | bcc02461025f89c0a74c93ccde88ef7384008f16 (diff) |
add homeassistant integration, set measurement period via MQTT
Diffstat (limited to 'sds011.lua')
-rw-r--r-- | sds011.lua | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -18,6 +18,8 @@ local c_sleep = 0x00 local c_work = 0x01 local c_workperiod = 0x08 +sds011.work_period = 0 + function sds011.finish_cmd(cmd) cmd = cmd .. string.char(0xff, 0xff) local checksum = 0 @@ -56,6 +58,7 @@ function sds011.set_work_period(period) if period < 0 or period > 30 then return end + sds011.work_period = period local cmd = string.char(c_head, c_id, c_workperiod, c_write, period) cmd = cmd .. string.char(0, 0, 0, 0, 0, 0, 0, 0, 0, 0) return sds011.finish_cmd(cmd) |