Is there a new version of code somewhere which works with openhan and makes use of the LAN version of the script?
If yes could someone link me to it. I would like to test it aswell.
Is there a new version of code somewhere which works with openhan and makes use of the LAN version of the script?
If yes could someone link me to it. I would like to test it aswell.
I donāt think you need to open up your network in order to have this connection to work. Did you try it with your local IP?
Nevertheless itās one of the big adventages of OpenHAB when you can reach your stuff from everywhere. So you can fe start/stop your Airco Units from everywhere you want. Have a look at the nginx solution to connect to your network in a secure way.
This one should be able to work locally.
https://github.com/mac-zhou/midea-msmart
I succeed in getting the info from the units, but couldnāt send commands to them. Maybe youāve got more luck with it?
Thanks i looked at that but for now that is too much of a hassle to find out. First i want to get my gear connected
I also have a website hosted and several other tasks on this machine. I am using Myopenhab.org for now.
I got some values from both aircons but it keeps blacklisting., Should i creat dummy things?
If yes, what binding should i use?
How do you mean that itās been blacklisted? The python script? If itās blacklisted by OH, I guess youāll need to add it to an exec.whitelist file. Fe: in /etc/openhab2/misc/exec.whitelist
/etc/openhab2/scripts/midea_check.sh
/etc/openhab2/scripts/midea_start.sh
Personally, I start the python script over a standard linux cron (every 20 min check and restart if necessary).
In the new updated version which uses the LAN conntection. Is the 17 degree bug still existent (the bug where it resets the air conditioner to 17 degree fan all the time ?
if i do:
python3 main.py
I get the following:
2020-06-22 09:56:51,740 Setting OH: ac_Woonkamer_active (active) = ON
2020-06-22 09:56:51,749 OH ac_Woonkamer_active not found, blacklisting
2020-06-22 09:56:51,750 Setting OH: ac_Woonkamer_online (online) = ON
2020-06-22 09:56:51,758 OH ac_Woonkamer_online not found, blacklisting
2020-06-22 09:56:51,758 Setting OH: ac_Woonkamer_indoor_temperature (indoor_temperature) = 24.5
2020-06-22 09:56:51,763 OH ac_Woonkamer_indoor_temperature not found, blacklisting
2020-06-22 09:56:51,763 Setting OH: ac_Woonkamer_outdoor_temperature (outdoor_temperature) = 31.0
2020-06-22 09:56:51,768 OH ac_Woonkamer_outdoor_temperature not found, blacklisting
2020-06-22 09:56:51,768 Setting OH: ac_Woonkamer_power_state (power_state) = OFF
2020-06-22 09:56:51,773 OH ac_Woonkamer_power_state not found, blacklisting
2020-06-22 09:56:51,774 Setting OH: ac_Woonkamer_target_temperature (target_temperature) = 21.0
2020-06-22 09:56:51,779 OH ac_Woonkamer_target_temperature not found, blacklisting
2020-06-22 09:56:51,779 Setting OH: ac_Woonkamer_operational_mode (operational_mode) = 1.0
2020-06-22 09:56:51,784 OH ac_Woonkamer_operational_mode not found, blacklisting
2020-06-22 09:56:51,784 Setting OH: ac_Woonkamer_fan_speed (fan_speed) = 102.0
2020-06-22 09:56:51,788 OH ac_Woonkamer_fan_speed not found, blacklisting
2020-06-22 09:56:51,789 Setting OH: ac_Woonkamer_swing_mode (swing_mode) = 0.0
2020-06-22 09:56:51,793 OH ac_Woonkamer_swing_mode not found, blacklisting
2020-06-22 09:56:51,794 Setting OH: ac_Woonkamer_eco_mode (eco_mode) = OFF
2020-06-22 09:56:51,799 OH ac_Woonkamer_eco_mode not found, blacklisting
2020-06-22 09:56:51,799 Setting OH: ac_Woonkamer_turbo_mode (turbo_mode) = OFF
2020-06-22 09:56:51,803 OH ac_Woonkamer_turbo_mode not found, blacklisting
So it is making connection to the ACās but i donāt know how to connect it to openhab.
Should i create things or bindings?
i already created the following items:
Switch ac_Woonkamer_online "Online [%s]" <switch> (GF_LivingRoom)
Switch ac_Woonkamer_power_state "Power state [%s]" <switch> (GF_LivingRoom)
Number ac_Woonkamer_operational_mode "Modus []" <pump> (GF_LivingRoom)
Switch ac_Woonkamer_active "Actief [%s]" <switch> (GF_LivingRoom)
Number ac_Woonkamer_target_temperature "Doel temperatuur [%dĀ°C]" <temperature_cold> (GF_LivingRoom)
Number ac_Woonkamer_indoor_temperature "Binnen temperatuur [%.1fĀ°C]" <temperature> (GF_LivingRoom)
Number ac_Woonkamer_outdoor_temperature "Buiten temperatuur [%.1fĀ°C]" <temperature> (GF_LivingRoom)
Number ac_Woonkamer_fan_speed "Fan speed []" <fan> (GF_LivingRoom)
Number ac_Woonkamer_swing_mode "Swing mode []" <flow> (GF_LivingRoom)
Switch ac_Woonkamer_eco_mode "Eco mode [%s]" <switch> (GF_LivingRoom)
Switch ac_Woonkamer_turbo_mode "Turbo mode [%s]" <switch> (GF_LivingRoom)
Switch ac_Zolder_online "Online [%s]" <switch> (AT_Bedroom)
Switch ac_Zolder_power_state "Power state [%s]" <switch> (AT_Bedroom)
Number ac_Zolder_operational_mode "Modus []" <pump> (AT_Bedroom)
Switch ac_Zolder_active "Actief [%s]" <switch> (AT_Bedroom)
Number ac_Zolder_target_temperature "Doel temperatuur [%dĀ°C]" <temperature_cold> (AT_Bedroom)
Number ac_Zolder_indoor_temperature "Binnen temperatuur [%.1fĀ°C]" <temperature> (AT_Bedroom)
Number ac_Zolder_outdoor_temperature "Buiten temperatuur [%.1fĀ°C]" <temperature> (AT_Bedroom)
Number ac_Zolder_fan_speed "Fan speed []" <fan> (AT_Bedroom)
Number ac_Zolder_swing_mode "Swing mode []" <flow> (AT_Bedroom)
Switch ac_Zolder_eco_mode "Eco mode [%s]" <switch> (AT_Bedroom)
Switch ac_Zolder_turbo_mode "Turbo mode [%s]" <switch> (AT_Bedroom)
(BTW. I am running on a hyper-v ubuntu-linux 20.04 server)
No binding or thing needed. The python script does the work. Just be sure that this script is running. I created a small script that checks every 20 minutes if it runs, and if not, it (tries) to start it.
Add (gPersChng) to each item lines. My items for reference:
Switch ac_Leefruimte_online "Leefruimte [%s]" <switch> (gPersChng, hvac)
Switch ac_Leefruimte_power_state "Status[%s]" <switch> (gPersChng, hvac_On, hvac_leefruimte_status)
Number ac_Leefruimte_operational_mode "Mode [%s]" <pump> (gPersChng, hvac_operational_mode)
Switch ac_Leefruimte_active "Activeer [%s]" <switch> (gPersChng)
Number ac_Leefruimte_target_temperature "Gewenste temperatuur [%d ĆC]" <temperature_cold> (gPersChng, hvac_target_temperature)
Number ac_Leefruimte_indoor_temperature "HVAC Hal [%.1f ĆC]" <temperature> (gPersChng, hvac_indoor_temperature, tem_HAL, tem_LEE, WO_tem)
Number a...
Before there was a bug that each time data was pulled that the air condition unit would switch mode to fan and switch to 17 degrees. Is that still the case with the latest version of the script ?
In my case, it works as expected. My temperature stays stable (fe the whole day here at 24), and mode is cooling now. But itās auto in my case. I donāt really change this.
@brononius I have just installed the midea-msmart via pip3 as shown on the github page of the project on my openhabian.
Could you please advice on how I can use this new midea-msmart with openhab.
I am a little lost right now
Guess Iāll need some extra info to know where you are.
Did you update the settings.py file with your specific settings?
Are you running the python script?
When you start this script, it gives you direct some good info about the status of your connection.
Btw, this script must run the whole time! so best to run it in a script that you start when you boot.
Not sure where you placed it, but in my case:
python3 /etc/openhab2/scripts/midea/main.py
Did you create the OpenHAB items already?
If so, do you have any entries for the items in the events.log?
Hello guys,
Is there anyone who could create an midea2mqtt version with this script?
That would make it easy to setup for everyone.
I would pay for a development of that.
best,
salexes
There is also a LAN branch from bricky now:
The only issue I have with that is that when using it the sound/beep is missing. Any idea how to get it back/activate the sound when using this script?
Trying out the LAN version.
I can nicely poll the unit, and the first run gives me all necessary data.
But then, something goes wrong?
2021-01-06 09:35:11,290 Setting OH: ac_acOuderkamer_outdoor_temperature (outdoor_temperature) = 3.5
2021-01-06 09:35:11,295 Setting OH: ac_acOuderkamer_power_state (power_state) = OFF
2021-01-06 09:35:11,299 Setting OH: ac_acOuderkamer_target_temperature (target_temperature) = 24.0
2021-01-06 09:35:11,304 Setting OH: ac_acOuderkamer_operational_mode (operational_mode) = 1.0
2021-01-06 09:35:11,309 Setting OH: ac_acOuderkamer_fan_speed (fan_speed) = 102.0
2021-01-06 09:35:11,313 Setting OH: ac_acOuderkamer_swing_mode (swing_mode) = 15.0
2021-01-06 09:35:11,318 Setting OH: ac_acOuderkamer_eco_mode (eco_mode) = OFF
2021-01-06 09:35:11,322 Setting OH: ac_acOuderkamer_turbo_mode (turbo_mode) = OFF
Exception in sse_loop: JSONDecodeError('Expecting value: line 1 column 1 (char 0)')
2021-01-06 09:35:12,889 Failure in sse_loop
Traceback (most recent call last):
File "main.py", line 317, in sse_loop
data = json.loads(evt.data)
File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Exception in sse_loop: JSONDecodeError('Expecting value: line 1 column 1 (char 0)')
2021-01-06 09:35:18,961 Failure in sse_loop
Traceback (most recent call last):
File "main.py", line 317, in sse_loop
data = json.loads(evt.data)
File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Exception in sse_loop: JSONDecodeError('Expecting value: line 1 column 1 (char 0)')
2021-01-06 09:35:25,821 Failure in sse_loop
Traceback (most recent call last):
File "main.py", line 317, in sse_loop
data = json.loads(evt.data)
File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
Iāve got also errors in openhab.log (OH3):
2021-01-06 09:55:49,148 Setting OH: ac_Ouderkamer_turbo_mode (turbo_mode) = OFF
2021-01-06 09:55:49.151 [ERROR] [rg.apache.cxf.jaxrs.utils.JAXRSUtils] - No message body reader has been found for class java.lang.String, ContentType: application/octet-stream
2021-01-06 09:55:49.151 [WARN ] [s.impl.WebApplicationExceptionMapper] - javax.ws.rs.WebApplicationException: HTTP 415 Unsupported Media Type
at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1382)
at org.apache.cxf.jaxrs.utils.JAXRSUtils.processRequestBodyParameter(JAXRSUtils.java:877)
at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:822)
at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:214)
at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:78)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:216)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPut(AbstractHTTPServlet.java:237)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:852)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:544)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1581)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1307)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:482)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1549)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1204)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:494)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:374)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:268)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:367)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:782)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:918)
at java.base/java.lang.Thread.run(Thread.java:834)
What version of python are you using? Iām currently on 3.8.
Iām also running OH3, not sure if that has an impact on the OH_URL?
I am using openhab 2 still for me everything works. (Except there is no audible feedback anymore when changing something)
In main.py, Iāve changed line 141 in main.py to
response = session.put(url, data=value, headers={'Content-type': 'text/plain'})
Functions seem to be working:
Iām missing the update of the indoor_temperature. That part isnāt working for the moment. Looks like just one update with start?
Sometimes, Iām still having following error. But not so often as before. Looks like itās not every run anymore.
Exception in sse_loop: JSONDecodeError('Expecting value: line 1 column 1 (char 0)')
2021-01-07 16:52:35,012 Failure in sse_loop
Traceback (most recent call last):
File "main.py", line 317, in sse_loop
data = json.loads(evt.data)
File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Glad you have found a solution to make it work with OH 3.0, will switch to it soon as wellā¦ Once I got the time to do it.
Will check later if indor temperature is updating for me when using it on oh 2.5
Any idea to get the ābeepā sound back ?
The outdoor temperature has been updated 346 in the last 12 hours (of course, Iām having 4 inside units, so 80x / 12 hour?). The inside temperature is updated 36? So 9x / 12 hour?
Maybe a āsmallā details, degrees seem to be only measure with 0,5 degrees difference? So maybe itās normal that these temperatures arenāt so often updated as fe a KNX or zwave sensor?
Any idea if this is build in the hvac units, or if itās something in the script?
Iāll check later on if I have a beeping sound when I change somethingā¦