Skip to content

Commit 7aa4922

Browse files
committed
onewire: add a dummy "night" variable for controlling automatic light switching on PIR
1 parent c6781fb commit 7aa4922

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/onewire.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ impl OneWire {
517517

518518
debug!("doing stuff");
519519
{
520+
let mut night = false;
520521
let mut sensor_dev = self.sensor_devices.write().unwrap();
521522
let mut relay_dev = self.relay_devices.write().unwrap();
522523

@@ -609,7 +610,7 @@ impl OneWire {
609610
"PIR_Trigger" => {
610611
if !relay
611612
.pir_exclude
612-
&& on
613+
&& on && (night || relay.pir_all_day)
613614
{
614615
//checking if bit is set (relay is off)
615616
if !relay.override_mode && new_state & (1 << i as u8) != 0 {
@@ -731,6 +732,9 @@ impl OneWire {
731732
"PIR_Trigger" => {
732733
if !yeelight.pir_exclude
733734
&& on
735+
&& (night
736+
|| yeelight
737+
.pir_all_day)
734738
{
735739
//checking if yeelight is off
736740
if !yeelight

0 commit comments

Comments
 (0)