Compare commits
7 Commits
lightingfx
...
2025.3.1
Author | SHA1 | Date | |
---|---|---|---|
b4fbc2f5e6
|
|||
e53e6ab5f2
|
|||
4a8a9e10de
|
|||
b628a0b197
|
|||
0f6b6a8275
|
|||
e23c78c971
|
|||
87ed0e89c0
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
/.vscode
|
||||
**.vscode
|
@ -13,7 +13,7 @@ if (outsideTemp > 32) {
|
||||
if (nightMode === 'on') {
|
||||
preset = "frost"
|
||||
} else {
|
||||
preset = "eco"
|
||||
preset = "activity"
|
||||
}
|
||||
}
|
||||
|
||||
|
33
climate/basement/basement_on.js
Normal file
33
climate/basement/basement_on.js
Normal file
@ -0,0 +1,33 @@
|
||||
const states = global.get('homeassistant.homeAssistant.states')
|
||||
const allowed = states['input_boolean.basement_studio_heat_allowed'].state
|
||||
const outsideTemp = states['weather.iron_nerd_weather_station'].attributes.temperature
|
||||
const todaysHighTemp = states['sensor.todays_high_temp'].state
|
||||
const basementTemp = states['sensor.basement_studio_temperature'].state
|
||||
|
||||
let power = {}
|
||||
let reason = {}
|
||||
|
||||
if (todaysHighTemp < 55) {
|
||||
power = 'on'
|
||||
reason = 'Todays High Temperature'
|
||||
} else if (outsideTemp < 40) {
|
||||
power = 'on'
|
||||
reason = 'Outside Temperature'
|
||||
} else if (basementTemp < 64) {
|
||||
power = 'on'
|
||||
reason = 'Basement Temperature'
|
||||
} else {
|
||||
power = 'off'
|
||||
}
|
||||
|
||||
if (allowed === 'on') {
|
||||
if (power === 'on') {
|
||||
node.status({fill:'green',shape:'dot',text:'Heater Needed: ' + reason})
|
||||
node.send(msg,null)
|
||||
} else {
|
||||
node.status({fill:'red',shape:'ring',text:'Heater Not Needed'})
|
||||
node.send(null,msg)
|
||||
}
|
||||
} else {
|
||||
node.status({fill:'red',shape:'ring',text:'Heat Disabled'})
|
||||
}
|
@ -7,17 +7,22 @@ const payload = msg.payload
|
||||
const newDuration = duration * 60
|
||||
|
||||
if (payload === 'on') {
|
||||
if (lux <= threshold || lights === 'on') {
|
||||
node.status({fill:'green',shape:'dot',text:'Lights On'})
|
||||
node.send([msg,null])
|
||||
if (lux <= threshold && lights === 'off') {
|
||||
node.status({fill:'green',shape:'dot',text:'Turning lights on'})
|
||||
node.send([msg,msg,null])
|
||||
} else {
|
||||
if (lights === 'on') {
|
||||
node.status({fill:'red',shape:'ring',text:'Lights already on'})
|
||||
node.send([null,msg,null])
|
||||
} else {
|
||||
node.status({fill:'red',shape:'ring',text:'Too bright'})
|
||||
}
|
||||
}
|
||||
} else if (payload === 'off') {
|
||||
if (lights === 'on') {
|
||||
msg.duration = newDuration
|
||||
node.status({fill:"green",shape:"dot",text:parseInt(duration) + ' minutes'})
|
||||
node.send([null,msg])
|
||||
node.send([null,null,msg])
|
||||
} else {
|
||||
node.status({fill:"red",shape:"ring",text:"Lights already off"})
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
const states = global.get('homeassistant.homeAssistant.states')
|
||||
const lights = states['light.mud_room_overhead'].state
|
||||
const selScene = states['input_text.mud_room_selected_scene'].state
|
||||
const duration = states['input_number.mud_room_lights_off_delay'].state
|
||||
const lux = parseInt(states['sensor.mud_room_illuminance'].state)
|
||||
const threshold = parseInt(states['input_number.mud_room_lux_threshold'].state)
|
||||
@ -7,17 +8,22 @@ const payload = msg.payload
|
||||
const newDuration = duration * 60
|
||||
|
||||
if (payload === 'on') {
|
||||
if (lux <= threshold || lights === 'on') {
|
||||
node.status({fill:'green',shape:'dot',text:'Lights On'})
|
||||
node.send([msg,null])
|
||||
if (lux <= threshold && (lights === 'off' || selScene === 'Nightlight')) {
|
||||
node.status({fill:'green',shape:'dot',text:'Turning lights on'})
|
||||
node.send([msg,msg,null])
|
||||
} else {
|
||||
if (lights === 'on') {
|
||||
node.status({fill:'red',shape:'ring',text:'Lights already on'})
|
||||
node.send([null,msg,null])
|
||||
} else {
|
||||
node.status({fill:'red',shape:'ring',text:'Too bright'})
|
||||
}
|
||||
}
|
||||
} else if (payload === 'off') {
|
||||
if (lights === 'on') {
|
||||
msg.duration = newDuration
|
||||
node.status({fill:"green",shape:"dot",text:parseInt(duration) + ' minutes'})
|
||||
node.send([null,msg])
|
||||
node.send([null,null,msg])
|
||||
} else {
|
||||
node.status({fill:"red",shape:"ring",text:"Lights already off"})
|
||||
}
|
||||
|
@ -9,17 +9,22 @@ const newDuration = duration * 60
|
||||
|
||||
if (sleeping === 'off') {
|
||||
if (payload === 'on') {
|
||||
if (lux <= threshold || lights === 'on') {
|
||||
node.status({fill:'green',shape:'dot',text:'Lights On'})
|
||||
node.send([msg,null])
|
||||
if (lux <= threshold && lights === 'off') {
|
||||
node.status({fill:'green',shape:'dot',text:'Turning lights on'})
|
||||
node.send([msg,msg,null])
|
||||
} else {
|
||||
if (lights === 'on') {
|
||||
node.status({fill:'red',shape:'ring',text:'Lights already on'})
|
||||
node.send([null,msg,null])
|
||||
} else {
|
||||
node.status({fill:'red',shape:'ring',text:'Too bright'})
|
||||
}
|
||||
}
|
||||
} else if (payload === 'off') {
|
||||
if (lights === 'on') {
|
||||
msg.duration = newDuration
|
||||
node.status({fill:"green",shape:"dot",text:parseInt(duration) + ' minutes'})
|
||||
node.send([null,msg])
|
||||
node.send([null,null,msg])
|
||||
} else {
|
||||
node.status({fill:"red",shape:"ring",text:"Lights already off"})
|
||||
}
|
||||
|
@ -9,17 +9,22 @@ const newDuration = duration * 60
|
||||
|
||||
if (sleeping === 'off') {
|
||||
if (payload === 'on') {
|
||||
if (lux <= threshold || lights === 'on') {
|
||||
node.status({fill:'green',shape:'dot',text:'Lights On'})
|
||||
node.send([msg,null])
|
||||
if (lux <= threshold && lights === 'off') {
|
||||
node.status({fill:'green',shape:'dot',text:'Turning lights on'})
|
||||
node.send([msg,msg,null])
|
||||
} else {
|
||||
if (lights === 'on') {
|
||||
node.status({fill:'red',shape:'ring',text:'Lights already on'})
|
||||
node.send([null,msg,null])
|
||||
} else {
|
||||
node.status({fill:'red',shape:'ring',text:'Too bright'})
|
||||
}
|
||||
}
|
||||
} else if (payload === 'off') {
|
||||
if (lights === 'on') {
|
||||
msg.duration = newDuration
|
||||
node.status({fill:"green",shape:"dot",text:parseInt(duration) + ' minutes'})
|
||||
node.send([null,msg])
|
||||
node.send([null,null,msg])
|
||||
} else {
|
||||
node.status({fill:"red",shape:"ring",text:"Lights already off"})
|
||||
}
|
||||
|
@ -12,17 +12,22 @@ const newDuration = duration * 60
|
||||
|
||||
if (peopleSleeping === false && nightMode === 'off') {
|
||||
if (payload === 'on') {
|
||||
if (lux <= threshold || lights === 'on') {
|
||||
node.status({fill:'green',shape:'dot',text:'Lights On'})
|
||||
node.send([msg,null])
|
||||
if (lux <= threshold && lights === 'off') {
|
||||
node.status({fill:'green',shape:'dot',text:'Turning lights on'})
|
||||
node.send([msg,msg,null])
|
||||
} else {
|
||||
if (lights === 'on') {
|
||||
node.status({fill:'red',shape:'ring',text:'Lights already on'})
|
||||
node.send([null,msg,null])
|
||||
} else {
|
||||
node.status({fill:'red',shape:'ring',text:'Too bright'})
|
||||
}
|
||||
}
|
||||
} else if (payload === 'off') {
|
||||
if (lights === 'on') {
|
||||
msg.duration = newDuration
|
||||
node.status({fill:"green",shape:"dot",text:parseInt(duration) + ' minutes'})
|
||||
node.send([null,msg])
|
||||
node.send([null,null,msg])
|
||||
} else {
|
||||
node.status({fill:"red",shape:"ring",text:"Lights already off"})
|
||||
}
|
||||
|
26
time-based/work-tomorrow.js
Normal file
26
time-based/work-tomorrow.js
Normal file
@ -0,0 +1,26 @@
|
||||
let tomorrow = msg.tomorrow
|
||||
let today = msg.today
|
||||
let number = {}
|
||||
let work_tomorrow = {}
|
||||
|
||||
if (tomorrow > 0) {
|
||||
work_tomorrow = "true"
|
||||
if (today == 0) {
|
||||
number = 0
|
||||
} else {
|
||||
number = 1
|
||||
}
|
||||
} else {
|
||||
work_tomorrow = "false"
|
||||
number = 0
|
||||
}
|
||||
|
||||
msg.work_tomorrow = work_tomorrow
|
||||
|
||||
node.status({fill:"green",shape:"dot",text:"Number " + number})
|
||||
|
||||
if (number == 0) {
|
||||
node.send([msg,null])
|
||||
} else {
|
||||
node.send([null,msg])
|
||||
}
|
Reference in New Issue
Block a user