From ae2481c8275e1935ea56eadd23515597a0d4b52b Mon Sep 17 00:00:00 2001 From: Def3nder <33399267+Def3nder@users.noreply.github.com> Date: Fri, 10 May 2019 17:46:22 +0200 Subject: [PATCH] Updated MagicHome with ESP8285 (markdown) --- MagicHome-with-ESP8285.md | 62 ++++++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/MagicHome-with-ESP8285.md b/MagicHome-with-ESP8285.md index 461157ea..aa358e31 100644 --- a/MagicHome-with-ESP8285.md +++ b/MagicHome-with-ESP8285.md @@ -8,7 +8,7 @@ Aside from it going 9-28v, there are no other external model numbers etc, howeve ## Identifying this board -Looking closely you can see it's an ESP8285, on the main board, it has the part number: `ZJ-WFMN-B V1.1` +Looking closely you can see it's an ESP8285, on the main board, it has the part number: `ZJ-WFMN-B V1.1` or `ZJ-WFMN-A V1.1` board top 1 board top 2 @@ -27,7 +27,7 @@ The `IO0` port is `GPIO0` that needs to be pulled to ground when powered on for Once flashed, I configured it as follows (using Tasmota v6.1.1): -ZJ-WFMN-B V1.1 +ZJ-WFMN-B V1.1 (RGBW-Version) | Field | Value | |---|---| @@ -37,7 +37,7 @@ ZJ-WFMN-B V1.1 |D7 GPIO13|40 PWM4| |D5 GPIO14|37 PWM1| -ZJ-WFMN-A V1.1 +ZJ-WFMN-A V1.1 (RGBW Version with RF) | Field | Value | Function | |---|---|---| @@ -49,13 +49,24 @@ ZJ-WFMN-A V1.1 |D8 GPIO15|40 PWM4|WHITE| -ZJ-WFMN-A V1.1(RGB version) +ZJ-WFMN-A V1.1 (RGB version) | Field | Value | Function | |---|---|---| |Module type|18 Generic|Module type| -|D1 GPIO5|38 PWM1|RED| -|D6 GPIO12|37 PWM2|GREEN| +|D1 GPIO5|37 PWM1|RED| +|D6 GPIO12|38 PWM2|GREEN| +|D7 GPIO13|39 PWM3|BLUE| + + +ZJ-WFMN-A V1.1 (RGB version with RF) + +| Field | Value | Function | +|---|---|---| +|Module type|18 Generic|Module type| +|D2 GPIO4|51 IRRecv|IR Remote| +|D1 GPIO5|37 PWM1|RED| +|D6 GPIO12|38 PWM2|GREEN| |D7 GPIO13|39 PWM3|BLUE| With all that done, one of the critical things I needed to do so I could set the colors was to run the command to set `SetOption15` to `1`. For me, this was sending the MQTT command (you will need to adjust for your config): @@ -71,7 +82,7 @@ mosquitto_pub -h openhab.sf -t 'cmnd/rgbled/color' -m '#ff0000ff' ### RF control -If you have the RF variant, you will want to configure the GPIOs like this: +If you have a RF variant, you will want to configure the GPIOs like this: ``` { "MagicHome RF", // Magic Home RF (ESP8266) - (Arilux LC10) @@ -89,4 +100,39 @@ If you have the RF variant, you will want to configure the GPIOs like this: 0, 0 }, ``` -After chosing the correct module type in your Tasmota configuration, press a key on the remote after boot for the device to learn your code. \ No newline at end of file + +or like this: + +``` + { "MagicHome RF", // Magic Home RF (ESP8285) - (IRrecv) + GPIO_USER, // GPIO00 Optional Button + GPIO_USER, // GPIO01 Serial RXD and Optional sensor + GPIO_LED1_INV, // GPIO02 Blue onboard LED (not soldered) + GPIO_USER, // GPIO03 Serial TXD and Optional sensor0 + GPIO_IRRECV, // GPIO04 RF receiver input + GPIO_PWM1, // GPIO05 RGB LED Green + 0, 0, 0, 0, 0, 0, // Flash connection + GPIO_PWM2, // GPIO12 RGB LED Blue + GPIO_PWM3, // GPIO13 RGBW LED White + 0, 0, 0 + }, +``` +After chosing the correct module type in your Tasmota configuration, press a key on the remote after boot for the device to learn your code. + +### Full Set of rules for IR remote +Each rule can only be 511 characters long, some of the colors below use the built in predefined shortcut color numbers. +``` +mosquitto_pub -t 'cmnd/RGBled/rule1' -m 'On IrReceived#Data=0x00FF906F Do Dimmer + EndOn On IrReceived#Data=0x00FF9867 Do Color2 1 EndOn On IrReceived#Data=0x00FFE817 Do HSBColor1 13 EndOn On IrReceived#Data=0x00FF02FD Do HSBColor1 23 EndOn On IrReceived#Data=0x00FF50AF Do HSBColor1 33 EndOn On IrReceived#Data=0x00FF38C7 Do HSBColor1 43 EndOn On IrReceived#Data=0x00FFB847 Do Dimmer - EndOn On IrReceived#Data=0x00FFD827 Do Color2 2 EndOn On IrReceived#Data=0x00FF48B7 Do HSBColor1 140 EndOn On IrReceived#Data=0x00FF32CD Do HSBColor1 160 EndOn' + +mosquitto_pub -t 'cmnd/RGBled/rule2' -m 'Rule2 On IrReceived#Data=0x00FF7887 Do HSBColor1 180 EndOn On IrReceived#Data=0x00FF28D7 Do HSBColor1 200 EndOn On IrReceived#Data=0x00FFF807 Do Power 0 EndOn On IrReceived#Data=0x00FF8877 Do Color2 3 EndOn On IrReceived#Data=0x00FF6897 Do HSBColor1 260 EndOn On IrReceived#Data=0x00FF20DF Do HSBColor1 280 EndOn On IrReceived#Data=0x00FF708F Do HSBColor1 300 EndOn On IrReceived#Data=0x00FFF00F Do HSBColor1 320 EndOn' + +mosquitto_pub -t 'cmnd/RGBled/rule3' -m 'Rule3 On IrReceived#Data=0x00FFB04F Do Power 1 EndOn On IrReceived#Data=0x00FFA857 Do Color2 12 EndOn On IrReceived#Data=0x00FFB24D Do Backlog Power 0; WakeupDuration 1; Dimmer 100; Wakeup EndOn On IrReceived#Data=0x00FF00FF Do Backlog Power 0; WakeupDuration 5; Wakeup EndOn On IrReceived#Data=0x00FF58A7 Do Backlog Scheme 2; Speed 1 EndOn On IrReceived#Data=0x00FF30CF Do Backlog Scheme 3; Speed 5 EndOn' +``` +After setting the rules you need to activate them with the following: +``` +mosquitto_pub -t 'cmnd/RGBled/rule1' -m 'ON' +mosquitto_pub -t 'cmnd/RGBled/rule2' -m 'ON' +mosquitto_pub -t 'cmnd/RGBled/rule3' -m 'ON' +``` + +The hex codes for the "Data" value come from the data tag when looking at the JSON sent via MQTT. You can also view this data on the Tasmota console screen. From here you can program it to do what ever you want. See here for more details: https://github.com/arendst/Sonoff-Tasmota/wiki/Rules