18 lines
609 B
JavaScript
18 lines
609 B
JavaScript
var states = global.get('homeassistant.homeAssistant.states')
|
|
var sunsetLights = states['input_boolean.sunset_lights_on'].state
|
|
var weather = states['weather.iron_nerd_weather_station'].state
|
|
|
|
if (sunsetLights === 'on') {
|
|
if (weather === 'sunny' || weather === 'clear-night') {
|
|
node.status({fill:"green",shape:"dot",text:"Nice Weather"});
|
|
return[msg,null,null]
|
|
} else {
|
|
node.status({fill:"grey",shape:"dot",text:"Shitty Weather"});
|
|
return[null,msg,null]
|
|
}
|
|
} else {
|
|
node.status({fill:"red",shape:"ring",text:"Disabled"});
|
|
return[null,null,msg]
|
|
}
|
|
|
|
return msg; |