Node-RED nodes to ESPhome devices
Your ESPHome device must be configured with the ESPHome API enabled.
In your device.yaml configuration file:
# Example configuration entry
api:See ESPHome documentation on api configuration for more information.
$ npm i node-red-contrib-esphomeInputs are sent to the node as JSON payloads. The list below provides a list of keys and values (and their expected value type) that may be sent to the "esphome out" nodes. It is helpful to watch the "esphome in" messages to learn which type and range of commands are expected by your device.
Some example message payloads are:
// to set a light on:
msg.payload = {'state': true}
// set a door lock to unlock:
msg.payload = {'command':0}
// to toggle a light to 42% brightness:
msg.payload = {'brightness': 42}
// to press a button:
msg.payload = trueButton inputs may be triggered with any payload in the input message. Simply send a timestamp, true, or other payload to the button node. Button type nodes provide no messages into Node-RED.
mode- optional. 0 - OFF, 1 - AUTO, 2 - COOL, 3 - HEAT, 4 - FAN_ONLY, 5 - DRY. SeesupportedModesListattr in configtargetTemperature- optional. floattargetTemperatureLow- optional. floattargetTemperatureHigh- optional. floatlegacyAway- optional. Boolean. Deprecated: usepresetwith AWAYfanMode- optional. 0 - ON, 1 - OFF, 2 - AUTO, 3 - LOW, 4 - MEDIUM, 5 - HIGH, 6 - MIDDLE, 7 - FOCUS, 8 - DIFFUSE, 9 - QUIET. SeesupportedFanModesListattr in configswingMode- optional. 0 - OFF, 1 - BOTH, 2 - VERTICAL, 3 - HORIZONTAL. SeesupportedSwingModesListattr in configcustomFanMode- optional. string. SeesupportedCustomFanModesListattr in configpreset- optional. 0 - NONE, 1 - HOME, 2 - AWAY, 3 - BOOST, 4 - COMFORT, 5 - ECO, 6 - SLEEP, 7 - ACTIVITY. SeesupportedPresetsListattr in configcustomPreset- optional. string. SeesupportedCustomPresetsListattr in config
legacyCommand- optional. 0 - OPEN, 1 - CLOSE, 2 - STOP. Deprecated: usepositionposition- optional. float. 0.0 - CLOSED, 1.0 - OPEN. SeesupportsPositionattr in configtilt- optional. float. 0.0 - CLOSED, 1.0 - OPEN. SeesupportsTiltattr in configstop- optional. boolean
state- optional. booleanspeed- optional. 0 - LOW, 1 - MEDIUM, 2 - HIGHoscillating- optional. booleandirection- optional. 0 - FORWARD, 1 - REVERSEspeedLevel- optional. integer. SeesupportedSpeedLevelsattr in config
state- optional. booleanbrightness- optional. floatred- optional. integer 0-255green- optional. integer 0-255blue- optional. integer 0-255colorMode- optional. integer. SeesupportedColorModesListattr in configcolorBrightness- optional. floatwhite- optional. integer 0-255colorTemperature- optional. integercoldWhite- optional. floatwarmWhite- optional. floatflashLength- optional. integereffect- optional. string. effect from effects array in config list
command- REQUIRED. 0 - UNLOCK, 1 - LOCK, 2 - OPENcode- optional. string. SeerequiresCodeattr in config
command- REQUIRED. 0 - MEDIA_PLAYER_COMMAND_PLAY, 1 - MEDIA_PLAYER_COMMAND_PAUSE, 2 - MEDIA_PLAYER_COMMAND_STOP, 3 - MEDIA_PLAYER_COMMAND_MUTE, 4 - MEDIA_PLAYER_COMMAND_UNMUTEvolume- optional. floatmediaUrl- optional. string
state- REQUIRED. float. SeeminValue,maxValue, andstepattrs in config
state- REQUIRED. string. SeeoptionsListattr in config
state- REQUIRED. booleantone- optional. string. SeetonesListattr in configduration- optional. integer. SeesupportsDurationattr in configvolume- optional. integer. SeesupportsVolumeattr in config
state- REQUIRED. boolean
state- REQUIRED. string. SeeminLength,maxLengthattrs in config

