Open Hurleyking opened 5 years ago
I did not find this flag (yet) in the query, but I'll try to dig for it a bit.
I found if change "def temperature(celsius, mode: 2)" to "def temperature(celsius, mode: 4)" the AC start in mode heat ;)
You have another funciont with translate number to string:
def mode_human
mode_value = 'unknown'
mode_value = 'auto' if mode == 1
mode_value = 'cool' if mode == 2
mode_value = 'dry' if mode == 3
mode_value = 'heat' if mode == 4
mode_value = 'fan' if mode == 5
Oh so it works, just not documented? \o/
work, but in request not have option to select. By default mode is 2, so em set values it possible add command.mode whit range 1 to 5 and change the value mode in function def temperature.
def temperature(celsius, mode: 2)
c = ((mode << 5) & 0xe0) | (celsius & 0xf) | ((celsius << 4) & 0x10)
@data[0x0c] = c
end
Ez lenne szerintem a legideálisabb megoldás. :)
I don't know the ruby at all. I managed to solve the change of mode with a hack. In bin/midea-ac file: I add a line after method_option :fan_speed, required: false, type: :numeric, aliases: '-f', desc: 'Fan speed' add: method_option :mode, required: false, type: :numeric, aliases: '-m', desc: 'Mode' I changed this line: command.temperature(options[:target_temperature]) if options[:target_temperature] to if options[:mode] == 2 command.modecool(options[:target_temperature]) if options[:target_temperature] elsif options[:mode] == 3 command.modedry(options[:target_temperature]) if options[:target_temperature] elsif options[:mode] == 4 command.modeheat(options[:target_temperature]) if options[:target_temperature] elsif options[:mode] == 5 command.modefan(options[:target_temperature]) if options[:target_temperature] else command.modeauto(options[:target_temperature]) if options[:target_temperature] end
lib/commands/set.rb after or instead def temperature(celsius, mode: 2) c = ((mode << 5) & 0xe0) | (celsius & 0xf) | ((celsius << 4) & 0x10) @data[0x0c] = c end add def modeauto(celsius, mode: 1) c = ((mode << 5) & 0xe0) | (celsius & 0xf) | ((celsius << 4) & 0x10) @data[0x0c] = c end
def modecool(celsius, mode: 2)
c = ((mode << 5) & 0xe0) | (celsius & 0xf) | ((celsius << 4) & 0x10)
@data[0x0c] = c
end
def modedry(celsius, mode: 3)
c = ((mode << 5) & 0xe0) | (celsius & 0xf) | ((celsius << 4) & 0x10)
@data[0x0c] = c
end
def modeheat(celsius, mode: 4)
c = ((mode << 5) & 0xe0) | (celsius & 0xf) | ((celsius << 4) & 0x10)
@data[0x0c] = c
end
def modefan(celsius, mode: 5)
c = ((mode << 5) & 0xe0) | (celsius & 0xf) | ((celsius << 4) & 0x10)
@data[0x0c] = c
end
It works now in command line: ./ruby midea-ac set DEVICE_ID --power=on --target-temperature=25 --mode=4 --fan-speed=50
where 1 - auto 2 - cool 3 - dry 4 - heat 5 - fan
Errors: The "set" command is also executed in the original code, but returns an error. The "get" command very often returns an error, in which case there is no response, only error code.
Traceback (most recent call last):
14: from midea-ac:23:in <main>' 13: from midea-ac:23:in
load'
12: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/midea-air-condition-0.0.3/bin/midea-ac:187:in <top (required)>' 11: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/base.rb:466:in
start'
10: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in dispatch' 9: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in
invoke_command'
8: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in run' 7: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/midea-air-condition-0.0.3/bin/midea-ac:41:in
get'
6: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/midea-air-condition-0.0.3/bin/midea-ac:137:in send_command' 5: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/midea-air-condition-0.0.3/lib/client.rb:52:in
appliance_transparent_send'
4: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/midea-air-condition-0.0.3/lib/client.rb:90:in api_request' 3: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/midea-air-condition-0.0.3/lib/client.rb:96:in
send_api_request'
2: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/net/http.rb:609:in start' 1: from /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/net/http.rb:910:in
start'
/usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/midea-air-condition-0.0.3/lib/client.rb:101:in `block in send_api_request': The asyn reply does not exist (RuntimeError)
Maybe there may be some time restrictions on commands?
Can anyone try the 7-temp-unit
branch? [tomorrow I can, but maybe someone can do it before ;)]
Perhaps the easiest thing would be to turn on in the last mode. A value can be obtained with a query before switching on.
Ez lenne szerintem a legideálisabb megoldás. :)
It's not an option as devices report back "default" values when they are turned off and not their last known state.
I noticed a very interesting thing. If the last mode of the climate was drying, the query returns with the following values: {"status":"off","target":"26","indoor":"21","outdoor":"11","mode":"dry","fan":"101","eco":"off"} fan: 101 !!! After the other modes, the good value returns. (max 100) It seems like this value is special in the fan mode.
Returns with the last values (target, mode, fan), not the default.
Its not possible turn on AC in mode Heat. I possible add command like this:
command.mode heat command.mode cool
Thanks, for good joob done