├── docs ├── .gitkeep ├── LD2450.pdf ├── LD2450.zh-CN.en.pdf ├── HLK-2450_TOOL(v1.4.2.0_20230515_ENG)(1).7z └── HLK-LD2450 1t2r motion target detection and tracking module manual v1.00.pdf ├── README.md ├── dashboard_example.yaml ├── custom_components └── ld2450_uart.h ├── esphome-ld2450.yaml └── LICENSE /docs/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/LD2450.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chreece/LD2450-ESPHome/HEAD/docs/LD2450.pdf -------------------------------------------------------------------------------- /docs/LD2450.zh-CN.en.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chreece/LD2450-ESPHome/HEAD/docs/LD2450.zh-CN.en.pdf -------------------------------------------------------------------------------- /docs/HLK-2450_TOOL(v1.4.2.0_20230515_ENG)(1).7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chreece/LD2450-ESPHome/HEAD/docs/HLK-2450_TOOL(v1.4.2.0_20230515_ENG)(1).7z -------------------------------------------------------------------------------- /docs/HLK-LD2450 1t2r motion target detection and tracking module manual v1.00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chreece/LD2450-ESPHome/HEAD/docs/HLK-LD2450 1t2r motion target detection and tracking module manual v1.00.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## This repo will no longer be maintained since there is a [PR](https://github.com/esphome/esphome/pull/5674) for native support in esphome and a better [library](https://github.com/uncle-yura/esphome-ld2450) till the PR to be merged 2 | 3 | ESPHome [LD2450](https://aliexpress.com/item/1005005584857890.html) mmWave Radar Sensor Custom Component 4 | 5 | ![https://aliexpress.com/item/1005005584857890.html](https://ae01.alicdn.com/kf/S7be2047a5aa647a4b34e61f1c6df960e4/Radar-Sensor-Module-HLK-LD2450-Human-Presence-Motion-Radar-Sensor-Module-Non-Contact-Monitoring-Detector-Sensor.jpg) 6 | 7 | Modified the yaml from [tsunglung](https://github.com/tsunglung/esphome-ld2450) for ESP32 to use the internal pull up resistors 8 | Added Presence Sensor and Number of detected targets 9 | 10 | ## Installation 11 | Set wifi_ssid and wifi_password in your esphome's secrets.yaml first 12 | 13 | 1. Place ld2450_uart.h into the custom_components of your esphome configuration folder 14 | 2. Create new device with the esphome-ld2450.yaml from this repository 15 | 16 | ## Wiring 17 | ESP32 | | LD2450 18 | ---------|-|-------| 19 | 5V |<->| VCC 20 | GND |<->| GND 21 | GPIO22 |<->| RX 22 | GPIO21 |<->| TX 23 | 24 | ## Dashboard Card 25 | ![image](https://github.com/Chreece/LD2450-ESPHome/assets/68458228/1b16a4a3-5386-4dca-a77c-c7864f38d9fe) 26 | 27 | From HACS download the auto-entities, layout-card and Ploty Graph Card (all Frontend integrations) 28 | Copy the code from dashboard_example.yaml into a new empty card in Home Assistant to grab all the LD2450 targets and present them in seperate cards (for title, the area of the device is used) 29 | 30 | ## Notice 31 | 1. Need to upgrade to firmware 2.04.23101915 - Bluetooth OTA available through [HLKRadarTool](https://www.pgyer.com/Lq8p) app 32 | -------------------------------------------------------------------------------- /dashboard_example.yaml: -------------------------------------------------------------------------------- 1 | type: custom:auto-entities 2 | unique: true 3 | show_empty: false 4 | card: 5 | type: custom:layout-card 6 | layout_type: masonry 7 | card_param: cards 8 | filter: 9 | template: | 10 | {%- for target in expand(integration_entities('esphome') 11 | | select('search', 'target') 12 | | select('search', '_x') 13 | | list) 14 | | rejectattr('state', 'in', ['0','unavailable', 'unknown', None]) 15 | | map(attribute='entity_id') 16 | | map('device_id') 17 | | unique 18 | | list -%} 19 | {{ {"type": "custom:plotly-graph", 20 | "title": area_name(target), 21 | "refresh_interval": 1, 22 | "hours_to_show": "current_day", 23 | "layout": { 24 | "height": 230, 25 | "margin": { 26 | "l": 50, 27 | "r": 20, 28 | "t": 20, 29 | "b": 40 30 | }, 31 | "showlegend": true, 32 | "xaxis": { 33 | "dtick": 100, 34 | "gridcolor": "RGBA(200,200,200,0.15)", 35 | "zerolinecolor": "RGBA(200,200,200,0.15)", 36 | "type": "number", 37 | "fixedrange": true, 38 | "range": [ 39 | 400, 40 | -400 41 | ] 42 | }, 43 | "yaxis": { 44 | "dtick": 100, 45 | "gridcolor": "RGBA(200,200,200,0.15)", 46 | "zerolinecolor": "RGBA(200,200,200,0.15)", 47 | "scaleanchor": "x", 48 | "scaleratio": 1, 49 | "fixedrange": true, 50 | "range": [ 51 | 600, 52 | 0 53 | ] 54 | } 55 | }, 56 | "entities": [ 57 | { "entity": "", 58 | "name": "Target1", 59 | "marker": { 60 | "size": 12 61 | }, 62 | "line": { 63 | "shape": "spline", 64 | "width": 5 65 | }, 66 | "x": [ 67 | "$ex hass.states[\"" + device_entities(target) 68 | | select('search', 'target1_x') 69 | | first + "\"].state" 70 | ], 71 | "y": [ 72 | "$ex hass.states[\"" + device_entities(target) 73 | | select('search', 'target1_y') 74 | | first + "\"].state" 75 | ] 76 | }, 77 | { "entity": "", 78 | "name": "Target2", 79 | "marker": { 80 | "size": 12 81 | }, 82 | "line": { 83 | "shape": "spline", 84 | "width": 5 85 | }, 86 | "x": [ 87 | "$ex hass.states[\"" + device_entities(target) 88 | | select('search', 'target2_x') 89 | | first + "\"].state" 90 | ], 91 | "y": [ 92 | "$ex hass.states[\"" + device_entities(target) 93 | | select('search', 'target2_y') 94 | | first + "\"].state" 95 | ] 96 | }, 97 | { "entity": "", 98 | "name": "Target3", 99 | "marker": { 100 | "size": 12 101 | }, 102 | "line": { 103 | "shape": "spline", 104 | "width": 5 105 | }, 106 | "x": [ 107 | "$ex hass.states[\"" + device_entities(target) 108 | | select('search', 'target3_x') 109 | | first + "\"].state" 110 | ], 111 | "y": [ 112 | "$ex hass.states[\"" + device_entities(target) 113 | | select('search', 'target3_y') 114 | | first + "\"].state" 115 | ] 116 | }, 117 | { 118 | "entity": "", 119 | "name": "Coverage", 120 | "mode": "lines", 121 | "fill": "tonexty", 122 | "fillcolor": "rgba(168, 216, 234, 0.15)", 123 | "line": { 124 | "shape": "line", 125 | "width": 1, 126 | "dash": "dot" 127 | }, 128 | "x": [ 129 | 0, 130 | "$ex 600 * Math.sin((2 * Math.PI)/360 * 60)", 131 | 450, 132 | 400, 133 | 300, 134 | 200, 135 | 100, 136 | 0, 137 | -100, 138 | -200, 139 | -300, 140 | -400, 141 | -450, 142 | "$ex -600 * Math.sin((2 * Math.PI)/360 * 60)", 143 | 0 144 | ], 145 | "y": [ 146 | 0, 147 | "$ex 600 * Math.cos((2 * Math.PI)/360 * 60)", 148 | "$ex Math.sqrt( 600**2 - 450**2 )", 149 | "$ex Math.sqrt( 600**2 - 400**2 )", 150 | "$ex Math.sqrt( 600**2 - 300**2 )", 151 | "$ex Math.sqrt( 600**2 - 200**2 )", 152 | "$ex Math.sqrt( 600**2 - 100**2 )", 153 | 600, 154 | "$ex Math.sqrt( 600**2 - 100**2 )", 155 | "$ex Math.sqrt( 600**2 - 200**2 )", 156 | "$ex Math.sqrt( 600**2 - 300**2 )", 157 | "$ex Math.sqrt( 600**2 - 400**2 )", 158 | "$ex Math.sqrt( 600**2 - 450**2 )", 159 | "$ex 600 * Math.cos((2 * Math.PI)/360 * 60)", 160 | 0 161 | ] 162 | } 163 | ], 164 | "raw_plotly_config": true 165 | } }}, 166 | {%- endfor -%} 167 | -------------------------------------------------------------------------------- /custom_components/ld2450_uart.h: -------------------------------------------------------------------------------- 1 | #include "esphome.h" 2 | 3 | #define CHECK_BIT(var, pos) (((var) >> (pos)) & 1) 4 | #define STATE_SIZE 8 5 | #define TARGETS 3 6 | 7 | static const char *TAG = "ld2450"; 8 | class LD2450 : public PollingComponent, public UARTDevice 9 | { 10 | public: 11 | LD2450(UARTComponent *parent) : UARTDevice(parent) {} 12 | 13 | // BinarySensor *lastCommandSuccess = new BinarySensor(); 14 | Sensor *lastCommandSuccess = new Sensor(); 15 | Sensor *target1Resolution = new Sensor(); 16 | Sensor *target1Speed = new Sensor(); 17 | Sensor *target1X = new Sensor(); 18 | Sensor *target1Y = new Sensor(); 19 | Sensor *target2Resolution = new Sensor(); 20 | Sensor *target2Speed = new Sensor(); 21 | Sensor *target2X = new Sensor(); 22 | Sensor *target2Y = new Sensor(); 23 | Sensor *target3Resolution = new Sensor(); 24 | Sensor *target3Speed = new Sensor(); 25 | Sensor *target3X = new Sensor(); 26 | Sensor *target3Y = new Sensor(); 27 | Sensor *targets = new Sensor(); 28 | 29 | uint32_t lastPeriodicMillis = millis(); 30 | 31 | uint16_t twoByteToUint(char firstByte, char secondByte) { 32 | return (uint16_t)(secondByte << 8) + firstByte; 33 | } 34 | 35 | void reportTargetInfo(int target, char *raw) { 36 | int16_t newX, newY, newSpeed, sum; 37 | uint16_t newResolution; 38 | 39 | ESP_LOGV(TAG, "Will reporting taget %d", target); 40 | 41 | switch (target) { 42 | case 0: 43 | newX = twoByteToUint(raw[0], raw[1] & 0x7F); 44 | if (raw[1] >> 7 != 0x1) 45 | newX = 0 - newX / 10; 46 | else 47 | newX = newX / 10; 48 | if (target1X->get_state() != newX) 49 | target1X->publish_state(newX); 50 | newY = twoByteToUint(raw[2], raw[3] & 0x7F); 51 | if (raw[3] >> 7 != 0x1) 52 | newY = 0 - newY / 10; 53 | else 54 | newY = newY / 10; 55 | if (target1Y->get_state() != newY) 56 | target1Y->publish_state(newY); 57 | newSpeed = twoByteToUint(raw[4], raw[5] & 0x7F); 58 | if (raw[5] >> 7 != 0x1) 59 | newSpeed = 0 - newSpeed; 60 | if (target1Speed->get_state() != newSpeed) 61 | target1Speed->publish_state(newSpeed); 62 | newResolution = twoByteToUint(raw[6], raw[7]); 63 | if (target1Resolution->get_state() != newResolution) 64 | target1Resolution->publish_state(newResolution); 65 | break; 66 | case 1: 67 | newX = twoByteToUint(raw[0], raw[1] & 0x7F); 68 | if (raw[1] >> 7 != 0x1) 69 | newX = 0 - newX / 10; 70 | else 71 | newX = newX / 10; 72 | if (target2X->get_state() != newX) 73 | target2X->publish_state(newX); 74 | newY = twoByteToUint(raw[2], raw[3] & 0x7F); 75 | if (raw[3] >> 7 != 0x1) 76 | newY = 0 - newY / 10; 77 | else 78 | newY = newY / 10; 79 | if (target2Y->get_state() != newY) 80 | target2Y->publish_state(newY); 81 | newSpeed = twoByteToUint(raw[4], raw[5] & 0x7F); 82 | if (raw[5] >> 7 != 0x1) 83 | newSpeed = 0 - newSpeed; 84 | if (target2Speed->get_state() != newSpeed) 85 | target2Speed->publish_state(newSpeed); 86 | newResolution = twoByteToUint(raw[6], raw[7]); 87 | if (target2Resolution->get_state() != newResolution) 88 | target2Resolution->publish_state(newResolution); 89 | break; 90 | case 2: 91 | newX = twoByteToUint(raw[0], raw[1] & 0x7F); 92 | if (raw[1] >> 7 != 0x1) 93 | newX = 0 - newX / 10; 94 | else 95 | newX = newX / 10; 96 | if (target3X->get_state() != newX) 97 | target3X->publish_state(newX); 98 | newY = twoByteToUint(raw[2], raw[3] & 0x7F); 99 | if (raw[3] >> 7 != 0x1) 100 | newY = 0 - newY / 10; 101 | else 102 | newY = newY / 10; 103 | if (target3Y->get_state() != newY) 104 | target3Y->publish_state(newY); 105 | newSpeed = twoByteToUint(raw[4], raw[5] & 0x7F); 106 | if (raw[5] >> 7 != 0x1) 107 | newSpeed = 0 - newSpeed; 108 | if (target3Speed->get_state() != newSpeed) 109 | target3Speed->publish_state(newSpeed); 110 | newResolution = twoByteToUint(raw[6], raw[7]); 111 | if (target3Resolution->get_state() != newResolution) 112 | target3Resolution->publish_state(newResolution); 113 | break; 114 | } 115 | sum = 0; 116 | if (target1Resolution->get_state() > 0){ 117 | sum+=1; 118 | } 119 | if (target2Resolution->get_state() > 0){ 120 | sum+=1; 121 | } 122 | if (target3Resolution->get_state() > 0){ 123 | sum+=1; 124 | } 125 | if (targets->get_state() != sum){ 126 | targets->publish_state(sum); 127 | } 128 | } 129 | 130 | void handlePeriodicData(char *buffer, int len) { 131 | if (len < 29) 132 | return; // 4 frame start bytes + 2 length bytes + 1 data end byte + 1 crc byte + 4 frame end bytes 133 | if (buffer[0] != 0xAA || buffer[1] != 0xFF || buffer[2] != 0x03 || buffer[3] != 0x00) 134 | return; // check 4 frame start bytes 135 | if (buffer[len - 2] != 0x55 || buffer[len - 1] != 0xCC) 136 | return; // data end=0x55, 0xcc 137 | char stateBytes[STATE_SIZE]; 138 | 139 | /* 140 | Reduce data update rate to prevent home assistant database size glow fast 141 | */ 142 | uint32_t currentMillis = millis(); 143 | if (currentMillis - lastPeriodicMillis < 1000) 144 | return; 145 | lastPeriodicMillis = currentMillis; 146 | for (int i = 0; i < TARGETS; i++) { 147 | memcpy(stateBytes, &buffer[4 + i * STATE_SIZE], STATE_SIZE); 148 | reportTargetInfo(i, stateBytes); 149 | } 150 | } 151 | 152 | void readline(int readch, char *buffer, int len) { 153 | static int pos = 0; 154 | if (readch >= 0) { 155 | if (pos < len - 1) { 156 | buffer[pos++] = readch; 157 | buffer[pos] = 0; 158 | } else { 159 | pos = 0; 160 | } 161 | if (pos >= 4) { 162 | if (buffer[pos - 2] == 0x55 && buffer[pos - 1] == 0xCC) { 163 | handlePeriodicData(buffer, pos); 164 | pos = 0; // Reset position index ready for next time 165 | } 166 | } 167 | } 168 | return; 169 | } 170 | 171 | void setup() override { 172 | set_update_interval(15000); 173 | } 174 | 175 | void loop() override { 176 | const int max_line_length = 160; 177 | static char buffer[max_line_length]; 178 | while (available()) { 179 | readline(read(), buffer, max_line_length); 180 | } 181 | } 182 | 183 | void update(){ 184 | } 185 | }; 186 | -------------------------------------------------------------------------------- /esphome-ld2450.yaml: -------------------------------------------------------------------------------- 1 | substitutions: 2 | devicename: ld2450 3 | upper_devicename: "Hi-Link LD2450" 4 | 5 | esphome: 6 | name: ${devicename} 7 | comment: ${upper_devicename} 8 | includes: 9 | - custom_components/ld2450_uart.h 10 | 11 | esp32: 12 | board: wemos_d1_mini32 13 | framework: 14 | type: arduino 15 | 16 | wifi: 17 | ssid: !secret wifi_ssid 18 | password: !secret wifi_password 19 | # reboot_timeout: 0s 20 | ap: 21 | password: "admin1234" 22 | ap_timeout: 30s 23 | 24 | # Enable logging 25 | logger: 26 | baud_rate: 0 27 | 28 | # Enable Home Assistant API 29 | api: 30 | 31 | ota: 32 | 33 | uart: 34 | id: uart_ld2450 35 | tx_pin: 36 | number: GPIO22 37 | mode: 38 | pullup: true 39 | rx_pin: 40 | number: GPIO21 41 | mode: 42 | pullup: true 43 | baud_rate: 256000 44 | parity: NONE 45 | stop_bits: 1 46 | # debug: 47 | # direction: BOTH 48 | # dummy_receiver: false 49 | 50 | custom_component: 51 | - lambda: |- 52 | return {new LD2450(id(uart_ld2450))}; 53 | components: 54 | - id: ld2450 55 | 56 | binary_sensor: 57 | - platform: template 58 | name: "Presence Detected" 59 | device_class: occupancy 60 | lambda: |- 61 | if (id(targets_sum).state > 0 ) { 62 | return true; 63 | } else { 64 | return false; 65 | } 66 | 67 | sensor: 68 | - platform: custom 69 | lambda: |- 70 | auto uart_component = static_cast(ld2450); 71 | return {uart_component->target1Resolution, uart_component->target1Speed, uart_component->target1X, uart_component->target1Y, 72 | uart_component->target2Resolution, uart_component->target2Speed, uart_component->target2X, uart_component->target2Y, 73 | uart_component->target3Resolution, uart_component->target3Speed, uart_component->target3X, uart_component->target3Y, 74 | uart_component->targets 75 | }; 76 | sensors: 77 | - name: "Target1 Resolution" 78 | unit_of_measurement: "nm" 79 | accuracy_decimals: 0 80 | icon: mdi:artboard 81 | id: target1 82 | - name: "Target1 Speed" 83 | unit_of_measurement: "cm/s" 84 | accuracy_decimals: 0 85 | icon: mdi:speedometer 86 | - name: "Target1 X" 87 | unit_of_measurement: "cm" 88 | accuracy_decimals: 0 89 | icon: mdi:map-marker-right 90 | - name: "Target1 Y" 91 | unit_of_measurement: "cm" 92 | accuracy_decimals: 0 93 | icon: mdi:map-marker-down 94 | - name: "Target2 Resolution" 95 | unit_of_measurement: "nm" 96 | accuracy_decimals: 0 97 | icon: mdi:artboard 98 | id: target2 99 | - name: "Target2 Speed" 100 | unit_of_measurement: "cm/s" 101 | accuracy_decimals: 0 102 | icon: mdi:speedometer 103 | - name: "Target2 X" 104 | unit_of_measurement: "cm" 105 | accuracy_decimals: 0 106 | icon: mdi:map-marker-right 107 | - name: "Target2 Y" 108 | unit_of_measurement: "cm" 109 | accuracy_decimals: 0 110 | icon: mdi:map-marker-down 111 | - name: "Target3 Resolution" 112 | unit_of_measurement: "nm" 113 | accuracy_decimals: 0 114 | icon: mdi:artboard 115 | id: target3 116 | - name: "Target3 Speed" 117 | unit_of_measurement: "cm/s" 118 | accuracy_decimals: 0 119 | icon: mdi:speedometer 120 | - name: "Target3 X" 121 | unit_of_measurement: "cm" 122 | accuracy_decimals: 0 123 | icon: mdi:map-marker-right 124 | - name: "Target3 Y" 125 | unit_of_measurement: "cm" 126 | accuracy_decimals: 0 127 | icon: mdi:map-marker-down 128 | - name: "Targets Sum" 129 | accuracy_decimals: 0 130 | icon: mdi:map-marker-down 131 | id: targets_sum 132 | 133 | switch: 134 | - platform: template 135 | name: "${device_name} Multi target mode" 136 | id: multi_target 137 | entity_category: diagnostic 138 | optimistic: true 139 | restore_mode: "RESTORE_DEFAULT_ON" 140 | turn_on_action: 141 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x04, 0x00, 0xFF, 0x00, 0x01, 0x00, 0x04, 0x03, 0x02, 0x01] 142 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x02, 0x00, 0x90, 0x00, 0x04, 0x03, 0x02, 0x01] 143 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x02, 0x00, 0xFE, 0x00, 0x04, 0x03, 0x02, 0x01] 144 | turn_off_action: 145 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x04, 0x00, 0xFF, 0x00, 0x01, 0x00, 0x04, 0x03, 0x02, 0x01] 146 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x02, 0x00, 0x80, 0x00, 0x04, 0x03, 0x02, 0x01] 147 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x02, 0x00, 0xFE, 0x00, 0x04, 0x03, 0x02, 0x01] 148 | - platform: template 149 | name: "${device_name} Bluetooth" 150 | id: bluetooth_switch 151 | entity_category: diagnostic 152 | optimistic: true 153 | restore_mode: "RESTORE_DEFAULT_ON" 154 | turn_on_action: 155 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x04, 0x00, 0xFF, 0x00, 0x01, 0x00, 0x04, 0x03, 0x02, 0x01] 156 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x04, 0x00, 0xA4, 0x00, 0x01, 0x00, 0x04, 0x03, 0x02, 0x01] 157 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x02, 0x00, 0xFE, 0x00, 0x04, 0x03, 0x02, 0x01] 158 | turn_off_action: 159 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x04, 0x00, 0xFF, 0x00, 0x01, 0x00, 0x04, 0x03, 0x02, 0x01] 160 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x04, 0x00, 0xA4, 0x00, 0x00, 0x00, 0x04, 0x03, 0x02, 0x01] 161 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x02, 0x00, 0xFE, 0x00, 0x04, 0x03, 0x02, 0x01] 162 | 163 | button: 164 | - platform: template 165 | name: "${device_name} Factory Reset" 166 | id: factory_reset 167 | entity_category: diagnostic 168 | on_press: 169 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x04, 0x00, 0xFF, 0x00, 0x01, 0x00, 0x04, 0x03, 0x02, 0x01] 170 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x02, 0x00, 0xA2, 0x00, 0x04, 0x03, 0x02, 0x01] 171 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x02, 0x00, 0xFE, 0x00, 0x04, 0x03, 0x02, 0x01] 172 | - platform: template 173 | name: "${device_name} Module Restart" 174 | id: module_restart 175 | entity_category: diagnostic 176 | on_press: 177 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x04, 0x00, 0xFF, 0x00, 0x01, 0x00, 0x04, 0x03, 0x02, 0x01] 178 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x02, 0x00, 0xA3, 0x00, 0x04, 0x03, 0x02, 0x01] 179 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x02, 0x00, 0xFE, 0x00, 0x04, 0x03, 0x02, 0x01] 180 | - platform: template 181 | name: "${device_name} Get Mac Address" 182 | id: get_macaddress 183 | entity_category: diagnostic 184 | on_press: 185 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x04, 0x00, 0xFF, 0x00, 0x01, 0x00, 0x04, 0x03, 0x02, 0x01] 186 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x04, 0x00, 0xA5, 0x00, 0x01, 0x00, 0x04, 0x03, 0x02, 0x01] 187 | - uart.write: [0xFD, 0xFC, 0xFB, 0xFA, 0x02, 0x00, 0xFE, 0x00, 0x04, 0x03, 0x02, 0x01] 188 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------