Skip to content

node-RED node that determines blind position based on the position of the sun and climatic conditions

License

Notifications You must be signed in to change notification settings

alisdairjsmyth/node-red-contrib-blindcontroller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-red-contrib-blindcontroller

npm version

A collection of Node-RED nodes that automate the control of household roller blinds based on the current position of the sun.

Install

Run the following command in the root directory of your Node-RED install

npm install node-red-contrib-blindcontroller

node-red-contrib-blindcontroller is compatible with node-red-contrib-sunpos.

Blind Controller

This node calculates the appropriate blind position to restrict or maximise direct sunlight through the associated window.

Properties

Blind Controller Properties Header

  • channel: identifier of the blind - which is used in the emitted msg.payload
  • mode: mode of control
    • Summer: constrains the extent to which direct sunlight is allowed to enter the room
    • Winter: maximises the amount of direct sunlight allowed to enter the room

Blind Controller Properties Dimensions

  • top: measurement from the floor to top of the window covered by the blind
  • bottom: measurement from the floor to bottom of the window covered by the blind
  • depth: (optional) the extent to which direct sunlight is to be allowed into the room through the window, defined as a length on the floor. (Only relevant in Summer mode.)
  • orientation: the bearing representing the perpendicular of the window to geographical north
  • negative offset: (optional) anti-clockwise offset from orientation for determination of whether the sun is coming through window. Offsets allow for obstacles that inhibit direct sunlight through the window. The obstacle could be a tree, a wall, anything.
  • positive offset: (optional) clockwise offset from orientation for determination of whether the sun is coming through window

Blind Controller Properties Positions

  • increment: the degree to which the blind position can be controlled
  • max open: (optional) the maximum extent the blind is allowed to be opened during daylight hours. Defaults to 0.
  • max closed: (optional) the maximum extent the blind is allowed to be closed during daylight hours. Defaults to 100.
  • night position: (optional) the position of the blind outside of daylight hours. Defaults to 100.
  • 0 is Closed: (optional) checkbox to indicate the blind uses 0% to indicate the blind is closed rather than open. Defaults to false

Blind Controller Properties Thresholds

  • sun altitude threshold: (optional) minimum altitude of the sun for determination of blind position
  • temperature threshold: (optional) temperature at which the blind will be set to the temperature threshold position while the sun is in the window. This setting overrides sun altitude threshold and depth in the calculation
  • temperature threshold position: (optional) the blind position associated with temperature threshold, default is fully closed
  • cloud cover threshold: (optional) maximum percentage of sky occluded by clouds for the calculation to be performed
  • cloud cover threshold position: (optional) the blind position associated with the clouds threshold, default is fully open
  • uv index threshold: (optional) maximum uv index for the calculation to be performed
  • uv index threshold position: (optional) the blind position associated with the uv index threshold, default to fully closed

Blind Controller Properties Manual

  • expiry period: (optional) the duration in minutes a manual setting will remain is place. Default to 120.

Calculation

The calculation requires the output of the Sun Position Node. This can be supplemented with current weather conditions, such as that from forecastio or weather underground. msg.topic should be set to weather, and msg.payload either or both of the following properties:

  • maxtemp: the forecasted maximum temperature for the day;
  • clouds: A numerical value between 0 and 1 (inclusive) representing the percentage of sky occluded by clouds. A value of 0 corresponds to clear sky, 0.4 to scattered clouds, 0.75 to broken cloud cover, and 1 to completely overcast skies.
  • uvindex: the current uv index

In Summer mode, the node calculates the appropriate blind position to restrict the amount of direct sunlight entering the room. This calculation includes:

  • determination of whether direct sunlight is entering the room based on the orientation of the blind and the azimuth of the sun - taking into account the negative and positive offset properties; and

    sunInWindow

  • dimensions of the window and the current altitude of the sun. The node is agnostic of unit of measure, though the same UOM should be used for all dimensions.

    sunInRoom

  • consideration of weather conditions against defined thresholds. As per window dimensions, weather conditions are also agnostic of unit of measure and used consistently.

In Winter mode, the node calculates the appropriate blind position to maximise the amount of direct sunlight entering the room. This calculation is based on whether direct sunlight is entering the room based on the orientation of the blind and the azimuth of the sun - taking into account the negative and positive offset properties. When the sun is in the window the blind will positioned in the max open setting, otherwise it will be positioned in the max closed setting. In overcast conditions the blind will be positioned in the max closed setting.

The mode can be changed via a message. msg.topic should be set to mode, and msg.payload with the following property:

  • mode: Set to either Summer or Winter

Output

In the event the node determines a blind position change is required, it will emit a msg.payload with the properties of the blind including:

  • blindPosition: the new position of the blind
  • blindPositionReasonCode: code of rationale of the new position
    • 01 - Manually set
    • 02 - Sun below horizon
    • 03 - Sun below altitude threshold
    • 04 - Sun not in window
    • 05 - Sun in window
    • 06 - Overcast conditions
    • 07 - Temperature forecast above threshold
    • 08 - Low UV Index
  • blindPositionReasonDesc: description of rationale of the new position (as above)

In addition, msg.data includes information useful for monitoring:

  • altitude: altitude of the sun in degrees
  • azimuth: azimuth of the sun in degrees
  • sunInWindow: boolean value indicating whether direct sunlight is entering the room based on the orientation of the blind and the azimuth of the sun - taking into account the negative and positive offset properties

msg.topic is set to "blind".

Manual Override

The node also supports manual overrides by processing messages with msg.topic set to blindPosition, and msg.payload containing the following properties:

  • channel: the channel of the blind
  • blindPosition: the new position of the blind
  • expiryperiod: (optional) the duration in minutes this manual setting will remain is place.

Manual positions can be forced to expire by processing a message with msg.topic set to blindPositionReset, and msg.payload containing the following properties:

  • channel: the channel of the blind
  • reset: boolean indicating manual setting is to be reset

Status

The node also reports its status within the Node-RED flow editor:

  • colour indicates whether it is currently considered daylight hours;
  • shape indicates whether the blind is fully closed or not;
  • text reports current blind position.

Multi Blind Controller

This node calculates the appropriate blind position to restrict direct sunlight through a number of windows. This node processes three types of input messages:

  • blind configuration where msg.topic equals blind, and msg.payload contains the following properties:
    • channel
    • mode
    • orientation
    • noffset (optional)
    • poffset (optional)
    • top
    • bottom
    • depth
    • altitudethreshold (optional)
    • increment
    • maxopen (optional)
    • maxclosed (optional)
    • temperaturethreshold (optional)
    • temperatrurethresholdposition (optional)
    • cloudsthreshold (optional)
    • cloudsthresholdposition (optional)
    • uvindexthreshold (optional)
    • uvindexthresholdposition (optional)
    • nightposition (optional)
    • expiryperiod (optional)
    • opposite (optional)
  • the output of the Sun Position Node;
  • current weather conditions, such as that from forecastio or weather underground. msg.topic should be set to weather, and msg.payload either or both of the following properties:
    • maxtemp
    • clouds
    • uvindex
  • a specified blind position (msg.topic set to blindPosition), which will remain in effect for the expiry period
    • channel
    • blindPosition
    • expiryperiod (optional)
  • reset blind Position (msg.topic set to blindPosition)
    • channel
    • reset
  • change mode for all blinds. msg.topic should be set to mode, and msg.payload with the following property:
    • mode: Set to either Summer or Winter

When processing either a Sun Position, Weather or Mode message, the blind position calculation is performed for each blind for which a configuration message has previously been received. Emitted messages from this node have the same properties as those emitted from the Blind Controller node.

This node does not report status within the Node-RED flow editor.

Sample Flow

The figure below represents a sample flow of Blind Controller node can be used to control 6 Qmotion blinds at the one geo location. The flow is initiated by an Injector node configured to run periodically.

Blind Controller Screenshot

The figure below represents a sample flow using the Multi Blind Controller node for the same use case, where the blind configuration is stored in a Cloudant database.

Multi Blind Controller Screenshot

About

node-RED node that determines blind position based on the position of the sun and climatic conditions

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •