ESPHome Smart Oil Diffuser & Nightlight

I’d like to thank @Nardol Patrick for turning me on to this thread. I’ve had this going for quite a while now, except for getting the RGB cycle off. If anyone wants to follow my set-up I have a webpage / video here. It is based on the Blakadder template listed on the webpage with a few minor tweaks here and there, including making the out of water work.

I would be glad to help anyone where I can.
I am very not good at HA Lights / RGB / Brightness stuff, so that is why I have not solved the turning off the RGB cycle thing as of yet. as of yet.

I also have some lovelace set-up with custom templates that may be of use to you. They use a couple of HACS repositories from finity69x2. If you want to see my implementation, it is in my GIT repository: (GitHub - SirGoodenough/Home-Assistant-Config: My HA Configuration... This is what I run for production in my house.)
Screenshot_2021-04-23_13-36-57

I encourage all of you when you find something that works and is stable for a while, go to the blakadder templates site for your device and put in a PR update. This is where the larger community will find it and you will help the most people.

I saw ESPHome on the title of this thread and never looked at it again in the past. All my stuff is Tasmota. ESPHome has never found a use in my HA config (YET)…

2 Likes

I’ve been playing with this more…
I created a bypass to the set-up blakadder suggested for color / rgb cycle. This bypasses the fan oscillation thing that I never got to work.
It also does a double trigger when you press the button which is not ideal, but it is functional. Any improvements are welcome.
Here is my rule set. The rule 1 is what I came up with today. The rules for changing fan speed and water error are currently in rule 2. The timer stuff as original in rule 3.

Rule1 on TuyaReceived#Data=55AA010700056E040001007F do power5 0 endon on TuyaReceived#Data=55AA010700056E0400010180 do power5 1 endon on power5#state=0 do tuyasend4 110,0 endon on power5#state=1 do tuyasend4 110,1 endon 

Rule2 on event#ON do backlog tuyasend 11,1 ; tuyasend4 110,0 endon on event#OFF do tuyasend1 11,0 endon on power3#state=1 do tuyasend4 103,1 endon on power3#state=0 do tuyasend4 103,0 endon on TuyaReceived#data=55AA010700050C050001011F do power4 1 endon on TuyaReceived#data=55AA010700050C050001001E do power4 0 endon

I do not believe that the TuyaMCU 15,110 set-up command is working as expected for changing the cycle mode. In my experience, the mode that the led’s appear to be in by looking at them has never changed the tasmota power5 ‘relay’ state. This bypasses that. I will also be removing the oscillation nonsence in the fan.yaml.

What happens is you push the power5 button, it flips cycle mode. When you push color mode, it stays that color. I have something messed up in the color section of the my light.yaml, however as I am not getting color wheel to set the color, but at least I can get it into the mode. Ideal would be for someone who knows the light.yaml to use what I have here maybe and get the light.yaml correct, adding cycle mode as an effect and having the color and brightness working.

I will continue to try, but as I said, this color / RGB stuff drives me crazy.

It would also be interesting to send tuyasend4 110, 0, 1 and 2. This configuration only sends 0 and 1, which is color and cycle. Mode 2 is white color…
would need to be a template to pull that off.

Have you looked at the recently updated Blakadder template?
It is now totally different, also for the Home Assistant integration.
Now mists are modes instead of speeds and there are some changes about lights.

I still tried nothing about lights but maybe these change could help?

EDIT: after the reset, it looks like I observe the same behavior:

  1. Press the Power button from the Tasmota Web interface;
  2. Press the Mist Strength button also from the web interface;
  3. Press the physical power buton on the device.

Actual behavior: diffuser stay on
Expected behavior: the diffuser should turn off

Nothing is sure now :wink:
Blakadder suggested me to compare the dpid types to the GD-30W because he has a suspicion they’re not the same, to paraphrase him :wink:

@Sir_Goodenough after some testing, it looks like the last GD-30W I suggested is not really the right one.

We cannot really use Tasmota and the physical button to control the device, for example when I switch the diffuser off using the physical button I have a command: error in the console and the state is not published.
Moreover, if I change the mist strength to high using Home Assistant then press the physical button to switch the diffuser off I have to press it twice.
It looks like the Maxcio diffuser is badly designed for that new template.
More information here: Maxcio 400ML aroma diffuser: doesn't seem to publish dpid updates if the physical button is used · Issue #1029 · blakadder/templates · GitHub

So I’m going to put the old template back :slight_smile: even if I stay interested if someone find a solution.

If someone can understand better than me, which is really not difficult :smiley: Here are some data I collected by switching the diffuser on using physical button, pressing again the physical button to put it into high mist strength then press a third and last time to switch it off.

18:05:16.964 {"TuyaReceived":{"Data":"55AA010700050C050001001E","Cmnd":7,"CmndData":"0C05000100","DpType5Id12":"0x00","12":{"DpId":12,"DpIdType":5,"DpIdData":"00"}}}
18:05:16.979 TYA: fnId=0 is set for dpId=12
18:05:16.984 {"TuyaReceived":{"Data":"55AA01070005670400010078","Cmnd":7,"CmndData":"6704000100","DpType4Id103":0,"103":{"DpId":103,"DpIdType":4,"DpIdData":"00"}}}
18:05:16.992 TYA: fnId=61 is set for dpId=103
18:05:16.995 SRC: Switch
18:05:16.998 CMD: Group 0, Index 1, Command "TUYAENUM", Data "0"
18:05:17.001 MQT: stat/diffuseur_bureau/RESULT = {"TuyaEnum1":0}
18:05:17.011 {"TuyaReceived":{"Data":"55AA01070005010100010110","Cmnd":7,"CmndData":"0101000101","DpType1Id1":1,"1":{"DpId":1,"DpIdType":1,"DpIdData":"01"}}}
18:05:17.020 TYA: fnId=11 is set for dpId=1
18:05:17.022 TYA: RX Relay-1 --> MCU State: On Current State:Off
18:05:17.024 SRC: Switch
18:05:17.030 MQT: stat/diffuseur_bureau/RESULT = {"POWER1":"ON"}
18:05:17.035 MQT: stat/diffuseur_bureau/POWER1 = ON
18:05:17.555 CFG: Saved to flash at F5, Count 23, Bytes 4096
18:05:21.181 TYA: Send "55aa00000000ff"
18:05:21.190 {"TuyaReceived":{"Data":"55AA010000010102","Cmnd":0,"CmndData":"01"}}
18:05:21.199 TYA: Heartbeat
18:05:21.588 {"TuyaReceived":{"Data":"55AA010700050C050001001E","Cmnd":7,"CmndData":"0C05000100","DpType5Id12":"0x00","12":{"DpId":12,"DpIdType":5,"DpIdData":"00"}}}
18:05:21.598 TYA: fnId=0 is set for dpId=12
18:05:21.602 {"TuyaReceived":{"Data":"55AA01070005670400010179","Cmnd":7,"CmndData":"6704000101","DpType4Id103":1,"103":{"DpId":103,"DpIdType":4,"DpIdData":"01"}}}
18:05:21.610 TYA: fnId=61 is set for dpId=103
18:05:21.613 SRC: Switch
18:05:21.616 CMD: Group 0, Index 1, Command "TUYAENUM", Data "1"
18:05:21.623 MQT: stat/diffuseur_bureau/RESULT = {"TuyaEnum1":1}
18:05:21.635 {"TuyaReceived":{"Data":"55AA01070005010100010110","Cmnd":7,"CmndData":"0101000101","DpType1Id1":1,"1":{"DpId":1,"DpIdType":1,"DpIdData":"01"}}}
18:05:21.646 TYA: fnId=11 is set for dpId=1
18:05:21.648 TYA: RX Relay-1 --> MCU State: On Current State:On
18:05:25.240 {"TuyaReceived":{"Data":"55AA0107000567040001027A","Cmnd":7,"CmndData":"6704000102","DpType4Id103":2,"103":{"DpId":103,"DpIdType":4,"DpIdData":"02"}}}
18:05:25.249 TYA: fnId=61 is set for dpId=103
18:05:25.252 SRC: Switch
18:05:25.255 CMD: Group 0, Index 1, Command "TUYAENUM", Data "2"
18:05:25.265 MQT: stat/diffuseur_bureau/RESULT = {"Command":"Error"}
18:05:25.277 {"TuyaReceived":{"Data":"55AA0107000501010001000F","Cmnd":7,"CmndData":"0101000100","DpType1Id1":0,"1":{"DpId":1,"DpIdType":1,"DpIdData":"00"}}}
18:05:25.287 TYA: fnId=11 is set for dpId=1
18:05:25.289 TYA: RX Relay-1 --> MCU State: Off Current State:On
18:05:25.292 SRC: Switch
18:05:25.298 MQT: stat/diffuseur_bureau/RESULT = {"POWER1":"OFF"}
18:05:25.303 MQT: stat/diffuseur_bureau/POWER1 = OFF

Blakadder answered there are more than two values, which I don’t notice/understand so I prefer hopping someone will understand all of these data which are worst than an entire week of mathematical lesons without sleep for me…

The last GD-W32 template looks better, less switches for things which are dimmers.

Next episode:
I continued to search for this Tasmota 9.X template and I have no error if I replace tuyaenum1 1 to tuyaenum1 2 but physical button state is not synchronized, only tTuyaEnum1 which is set to 0 for low speed, 1 for high and 2 when the diffuser is off when using the physical button.
DPID1 is not updated at all.

@Sir_Goodenough except if I have miss-understood something, this template give the ability to have the mode you mentioned for lights but maybe you already seen it.

I know that my device buttons are working as my config has them now, and so does the Lovelace interface. I only have color mode to switch between lock and rotate. I can’t pick a color, but everything else works (for me). Kind of reluctant to change now too much.

I might have a strange device as with the previous configuration, physical button also don’t work right :slight_smile:
I did not notice that before or there are changes with last Tasmota version.
As I did not break everything it will also be OK for me with the last GD-30W template where I have less switches.

Thanks for your answer.

I am thinking about buying another diffuser like this that is not Tuya convertible and would need a chip transplant. Has anyone bought one that was not flash-able and can give me a style / source to I can buy the same?
I don’t really need one, but want to do a transplant video to help the community, so don’t want to end up buying a bunch and sending them back.

I’m looking for a way to convert a Alfawise Diffuser ( SJ-07 ). How can I know if I could convert it or not ?
( Alfawise SJ - 07C Diffuseur d'Huile Essentielle pour Humidificateur | Gearbest France )

1 Like

If you have it. Try the tyua convert hack or open it up and see if there is an esp chip. If it’s a newly released device, tyua convert will likely not work

I’m confused as to where to put this code, validation fails no matter what I try :frowning:

Could you post your whole config file please?

Hello Guys,

I’m new to the HA world and setting my Diffusor has been a challenge.

Has Anyone been able to control de ASUKUKI MODEL RGB color, fan power or water notification through HA ?

I’ve soldered, flashed tasmota and tryed all the solutions above and still wasnt able to controle the LED color or make tasmota publish the fanmode and error…

I can setup the blueprint and automation but the configuration.yaml always returns an error on all models that you guys posted above…

I’ve already tried all the templates and rules and for now what i’ve done is create an automation to auto turn the led off when i turn the fan off…

my main priority now is to make the mist mode and water error to work… can anyone help me ?

thanks!

Never got mine working. I tried Asakuki 500ml Aroma Diffuser Template for Tasmota but this never worked for me, I assume user error or not all Asakukis are the same or something. It was completely broken following the instructions there. I did venture to their discord but it didn’t seem a friendly place to be asking questions of a beginner nature.

Are you trying to use Tasmota or Esphome?
What are the configuration file errors?

Dear every contributor to this thread.
I use EspHome exclusively now and I’m modifying original post with my current config. It may be buggy/incomplete where mist levels are concerned, but that is outside of my needs.

Out of water alert
Personally I have given up on out of water errors, it doesn’t matter to me because:

  • Scent usually runs out before water.
  • Device turns off in home assistant when it’s out of water anyway. I could automate attempting a second turn on to be certain it’s due to ‘out of water’.
  • The rate of diffusion is very constant, so you could even make a gauge in HA to show how much water or time is left, if it mattered. Time it once - visually or use some other sensor in your home to see exactly when the LED turns off.

LED
Again, I have specific needs and usecases so having it work perfectly like a light no longer matters to me. I have mine set to automatically turn off rainbow mode on boot
I have specific colors triggered by actions, currently it turns on (to green) when my laptop is logged in and goes red when on a zoom call.

1 Like

thanks for the reply! I’m using Tasmota.

I’ve already managed to setup the mist fan control and water error…

My main problem now is to fix the RGB light…

i’ve used the code below to setup an MQTT light that work… it fixes the RGB light and control the brightness … the only thing i’m trying to fix is to make it read the last brightness level since with the current setup when i move the trigger to “on” it stays on brightness 1.

light:

- platform: mqtt

  name: "Leds Diffuseur Salon"

  unique_id: light.diffuser_lamp

  command_topic: "cmnd/difusor/EVENT"

  state_topic: "tele/difusor/STATE"

  state_value_template: "{% if value_json.POWER2 == 'ON' %}ON{% else %}OFF{% endif %}"

  payload_on: "ON"

  payload_off: "OFF"

  brightness_command_topic: "cmnd/difusor/Dimmer"

  brightness_state_topic: "tele/difusor/RESULT"

  brightness_scale: 100

  brightness_value_template: "{% if value_json.TuyaReceived is defined and value_json.TuyaReceived['108'].DpId == 108 %}{{ value_json.TuyaReceived['108'].Type3Data[12:14]|int(base=16) }}{% endif %}"

  availability_topic: "tele/difusor/LWT"

  payload_available: "Online"

  payload_not_available: "Offline"

  qos: 1

  retain: false

  rgb_command_topic: "cmnd/difusor/tuyasend3"

  rgb_command_template: "{% set brightness = state_attr('light.diffuser_lamp','brightness') | int %}{{ '108,%02x%02x%02x646464' | format(red, green, blue)}}{{ '%02x' | format(brightness) }}"

  rgb_value_template: "{% if value_json.TuyaReceived is defined and value_json.TuyaReceived['108'].DpId == 108 %}{{ (value_json.TuyaReceived['108'].Type3Data[0:2]|int(base=16),value_json.TuyaReceived['108'].Type3Data[2:4]|int(base=16),value_json.TuyaReceived['108'].Type3Data[4:6]|int(base=16)) | join(',')}}{% endif %}"

  rgb_state_topic: "tele/difusor/RESULT"

Thanks for being specific. Sounds like you made good progress.
Unfortunately I’m done with Tasmota and mqtt. My (limited) knowledge and config is gone.

So what template/config you used on the device?

I suspect this config will work for the out of water alert. Let me know!

tuya:

sensor:
  - platform: "tuya"
    name: $devicename out of water
    sensor_datapoint: 12