Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand the auto light feature #166

Open
red3 opened this issue May 27, 2024 · 18 comments
Open

Expand the auto light feature #166

red3 opened this issue May 27, 2024 · 18 comments

Comments

@red3
Copy link

red3 commented May 27, 2024

My ac has the built-in auto light feature, which automatically turn the panel light on or off based on the light Illuminance environment.

Can we expand the current auto light feature to support the built-in one?

Additionally, the command of the built-in auto light feature is LigSen, and it’s value would be 0 means on and 1 means off (quite weird it uses 0 to represent on state and I double checked)

@toughvj
Copy link
Contributor

toughvj commented May 28, 2024

challenge accepted

@red3
Copy link
Author

red3 commented May 29, 2024

hey @toughvj , just add some details here:
I've started looking into the javascript files within the Gree+ app and found a few methods might helpful, comments are added by me by analyzing the contexts, so they can be inaccurate):

setLig:function(t) {
    var e=0,n=0;
    switch(t.value){
      case 0:
        e=0,n=1;break; // off
      case 1:
        e=1,n=1;break; // on
      case 2:
        e=1,n=0;break; // auto
      default:break
    }
    this.setState(["ableSend",!0]),
    this.sendData({Lig:e,LigSen:n})
}

LigStatus:function(){
    return console.log("LigStatus=======",[0,0,2,1][2*this.Lig+this.LigSen]),
    [0,0,2,1][2*this.Lig+this.LigSen]
    // 3 for on;
    // 2 for off;
    // 1 for auto
}

seed like we need an input_selector to represent the light status or maybe just another input_bool to represent built-in auto light on/off

@toughvj
Copy link
Contributor

toughvj commented May 31, 2024

We should replace light input boolean and auto_light with input_selctor with options:

  • on
  • off
  • auto
  • light sensor based

I need some time to take a look at this

@toughvj
Copy link
Contributor

toughvj commented Jun 24, 2024

@red please try attached file. To enable light sensor add light_sensor: to config.yaml with input_boolean entity id. Please let me know if it works.
climate.txt

@red3
Copy link
Author

red3 commented Jun 25, 2024

Thanks for your work, I will try this later this week.

@red3
Copy link
Author

red3 commented Jun 26, 2024

@toughvj I tried and it did not turn the inner light sensor on, maybe we should try to use command Lig:1,LigSen:0 like I previous said to let it work.
Another thinking: can we turn off both the lights and the light sensor when the ac is turned off, cause if the light sensor remains on when the ac is off, and it is daytime, the lights will turn on automaticly, which can be annoying.

@toughvj
Copy link
Contributor

toughvj commented Jun 26, 2024

@red3 I need log from HA and configuration.yaml to see what is wrong.

@red3
Copy link
Author

red3 commented Jun 26, 2024

I didn't turn on logs on my previous test, I'm currently away from home and I will collect the logs next time. From what I observed on the HA dashboard ui: when I turned the light on first, and then turned the light sensor on, the gree+ app was displayed as AUTOMATICALLY which was expected, wish this would be helpful.

@toughvj
Copy link
Contributor

toughvj commented Jun 26, 2024

Strange thing. If the gree+ application shows light as automatically, it means that both parameters have been set correctly in the device. Maybe there should be another parameter there?

Can U send me back javascript files from gree+ app?

@red3
Copy link
Author

red3 commented Jun 26, 2024

As I said the gree+ app only display automatically when I turn on lights before turn on light sensor, I guess we should use both
Lig:1 and LigSen:0 to represent turn on the built in light sensor.
I will send you the JavaScript file tomorrow.

@toughvj
Copy link
Contributor

toughvj commented Jun 26, 2024

try attached file but remove light_sensor entity id from configuration. Then try switch light on, this would send {'Lig':1, 'LigSen':0} This is for testing only.
climate.txt

@red3
Copy link
Author

red3 commented Jun 27, 2024

hey @toughvj this version works well:
when I turn light on, gree+ app shows Automaticly
when I turn light off, gree+ app shows Off
Also, attached file is javascript file from gree+ app, you can search setLig:function for detailed information
gree.txt

@toughvj
Copy link
Contributor

toughvj commented Jun 27, 2024

ok, and light sensor works well?

@red3
Copy link
Author

red3 commented Jun 27, 2024

Do you mean whether the built-in light sensor functionality is working correctly?
yeah it's working well

@toughvj
Copy link
Contributor

toughvj commented Jun 27, 2024

this is some kind of starting point. Need some time to get this working.

@toughvj
Copy link
Contributor

toughvj commented Jul 1, 2024

@red3 please try attached file.
from this version auto_light, auto_xfan and light_sensor must be provided with input_boolean entity id.
Please give any feedback if it fit's your needs.
climate.txt

@red3
Copy link
Author

red3 commented Jul 3, 2024

this version works fine, thanks for your excellent work. @toughvj

@toughvj
Copy link
Contributor

toughvj commented Jul 4, 2024

@RobHofmann this can be closed, solved in #188

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants