-
Notifications
You must be signed in to change notification settings - Fork 64
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
Simple way for remote control from linux server? #23
Comments
Hi, There is no command line utility at the moment, but there are implementations in multiple languages that can be adapted. I have a python test script somewhere which can send commands to the AC. I get back to you when I found it. |
Will be nice if you can do that with all info step by step how I can use it...your script using gree api? I need to control my AC from remote location, not from local network... Thanks. |
The script can only communicate directly with the units. If you can setup your firewall to allow trafic to your AC units, the script will reach them, but it uses the local communication protocol. I don't have implementation for the cloud API unfortunately. |
Ok, I can work with it, I can open firewall ports to AC... Thanks. |
Just a quick update, I'm working on the script. It's not finished, yet. You can track the progress on this branch: https://github.com/tomikaa87/gree-remote/tree/feature/python-cli-script/PythonCLI |
Can I use it to set temperature on my gree ac, how? In this moment I just need that function... |
I've finished with the initial implementation of the device control function of the script. You can use it in the following way:
The script can be found here: https://github.com/tomikaa87/gree-remote/blob/feature/python-cli-script/PythonCLI/gree.py |
Great, I`ll test it, thanks. |
Hi! Could you please adapt this script so it doesnt use pycrypto? For one, i'm having issues installing it, and second everywhere I read it states that pycrypto is compromised and not developing anymore. |
@dulemis hi, i've updated the script, it now uses |
Super, thank you very much! Do you have any idea why I get following error? pip install cryptographyCollecting cryptography
ERROR: Command errored out with exit status 1: /opt/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/opt/tmp/pip-install-ow212_5a/cffi/setup.py'"'"'; file='"'"'/opt/tmp/pip-install-ow212_5a/cffi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /opt/tmp/pip-record-wa88x_k_/install-record.txt --single-version-externally-managed --prefix /opt/tmp/pip-build-env-t5jylq31/overlay --compile --install-headers /opt/tmp/pip-build-env-t5jylq31/overlay/include/python3.7/cffi Check the logs for full command output.ERROR: Command errored out with exit status 1: /opt/bin/python3 /opt/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /opt/tmp/pip-build-env-t5jylq31/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"'' Check the logs for full command output. |
@dulemis according to this line: Edit: after a quick search I've found this: https://openwrt.org/packages/pkgdata/python-cryptography |
opkg install python3-cryptographyInstalling python3-cryptography (2.8-1) to root... python3 /jffs/gree.py search -b 10.1.1.63Traceback (most recent call last): |
Maybe you can try to modify the script and load the module manually using a full path: https://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path |
Thank you! I seem to have continued issues with my environment. See below. /jffs/gree.pyTraceback (most recent call last): I noticed that cryptographt module is getting installed in a folder named pythhn3.8/site-packages, but my Python version is actually 3.7 and all my current files and packages are located in python3.7/site-packages. So I tried moving the cryptography folder to python3.7-folder, and then i started getting above magic number error... |
Please ignore my last post, i've upgraded to Python 3.8 now and then it works. /jffs/gree.py search -b 10.1.1.63Searching for devices using broadcast address: 10.1.1.63 |
I got to work by replacing the broadcast address with the actual IP of the Gree unit. Then I got the ID and key, so everything seems to work! |
Two more questions! 1 do you have the original version with pycrypto? Could you publish it I would like to test something.
|
Thank you @tomikaa87, I've managed to make this work, but had to set the broadcast param to the actual AC's IP. When I tried with 192.168.1.255 it gave me the same permission error as for @dulemis. This answer gives a hint, but I couldn't make it work because of lack of Python knowledge. @dulemis You can easily tweak the Python code so it sends an array of more than one element of |
BTW, @tomikaa87, you should update the script's URL with |
Hi Marko, Great find, I added However, I tried your changed code and it doesnt work to get/set multiple values in one request. gree.py get Pow, SetTem -c 10.1.1.16 -k xxxxxxxxxx -i xxxxxxxxx |
You should use single and double quotes exactly as in example in order for that hack to work. |
Hello again @sm4rk0, Okey, sorry I misunderstood, it does work now. gree.py set 'Pow 1", "SetTem 22' |
@tomikaa87 do you know if is it possible to retrieve the inside/outside temperature from the Gree unit somehow? |
@dulemis unfortunately my device doesn't have that feature and I didn't manage to capture the related communication. If your device can do that and the mobile app show this temperature, you should try capturing the data. On android, you can use Packet Capture, or if you have a laptop and a pendrive, you can use Kali Linux live to capture WiFi communication. You can decrypt the data in the packets with the device-specific password. |
@tomikaa87 Script works great! Didn't notice your guide in this issue before now. Maybe you could add it to a I also created my own guide fwiw: |
Hello all root@jeedom:/var/www/html/plugins/script/data# ./gree.py search -b 192.168.170.109 seems does not return any unique ID . Thanks for your great job. |
Hi, I've updated the script to have a new |
Hi tomikaa87
root@jeedom:/var/www/html/plugins/script/data# ./gree.py search -b 192.168.170.255 --verbose |
I see the problem, the script looks for Edit: I've just updated the script, please try it again. |
now is ok ! thanks a lot!!! Search finished, found 1 device(s) |
Hi all try to set time using gree.py script doc said 👍
pack: { //getting time
//set time
seems missing the sub:"Mac adress" option in pack data. i also need to use the scheduling script which seems not implement into the py script. thanks for all. edit
|
EDIT: Never mind, seems as the script works even when leaving the ID empty. My friend got two Gree units installed, but this script doesnt expose the IDs anymore? gree.py search -b 192.168.1.254 |
Hi @dulemis, I see that you've made the script work without the ID, but to verify the root cause of the issues, can you please run it with |
Yes, of course! gree.py search -b 192.168.1.254 --verbose |
Hi,
I want to use your code for remote control my gree ac, I need to auto set temperature on ac at some time using cron on my linux server...is it easy possible with "gree-remote" code?
Also I must note that my server is not on same network as AC!
If it possible with gree-remote code on linux server please somebody write how I can easy do that, please step by step...
Thanks.
The text was updated successfully, but these errors were encountered: