This @fredrike idea is very good and it may solve the problems with the update of the current status of the device.
It would be nice to do some tests and see if there is a broadcast packet every time we use the remote control, apart from the ones we get periodically. This way we could update the status of the component right away.
Are there issues with updates now?
Feel freeā¦ I donāt even have that AC model.
Did you (@phenriques3000, @pavlo) manage to get some XML examples I can continue work on?
Hi @fredrike,
I finally got some time to debug problems
First thing I can see is that probably the seq number is not set fine:
Sending message: bā<msg msgid=āSyncStatusReqā type=āControlā seq="-3600">\n<SyncStatusReq></SyncStatusReq></msg>ā
-3600 doesnāt seem fine. We know that apart from the SyncStatusReq, the rest of the commands should have a different seq number every time. -3600 seems to be fixed.
Edit: Confirmed the seq number is wrong also when sending another command:
Sending message: bā<msg msgid=āSetMessageā type=āControlā seq="-3600">\n<SetMessage><SetTemp>79.34</SetTemp></SetMessage></msg>ā
I can also confirm that you can send messages like the following:
<msg msgid="SetMessage" type="Control" seq="19563">
<SetMessage>
<SetTemp>74</SetTemp>
<BaseMode>heat</BaseMode>
<WindSpeed>Low</WindSpeed>
</SetMessage>
</msg>
When you get the status, you correctly get:
<msg msgid="statusUpdateMsg" type="Control" seq="999">
<statusUpdateMsg>
<BaseMode>heat</BaseMode>
<TurnOn>on</TurnOn>
<Opt_display>on</Opt_display>
<Opt_ECO>off</Opt_ECO>
<Opt_super>off</Opt_super>
<SetTemp>74</SetTemp>
<WindSpeed>Low</WindSpeed>
<Degree_Half>off</Degree_Half>
<Opt_healthy>off</Opt_healthy>
<Opt_antiMildew>off</Opt_antiMildew>
<Opt_StereoWind>off</Opt_StereoWind>
<Opt_heating>off</Opt_heating>
<Countdown_Timer_Off>00:00</Countdown_Timer_Off>
<Countdown_Timer_On>00:00</Countdown_Timer_On>
<Infrared_Direct>off</Infrared_Direct>
<Infrared_TurnOn>off</Infrared_TurnOn>
<HumidityEnable>off</HumidityEnable>
<CleannessEnable>off</CleannessEnable>
<WindDirection_H>off</WindDirection_H>
<WindDirection_V>off</WindDirection_V>
<IndoorTemp>75</IndoorTemp>
<Opt_sleepMode>off:0:0:0:0:0:0:0:0:0:0</Opt_sleepMode>
<OutdoorTemp>0</OutdoorTemp>
<ErrorCode>0</ErrorCode>
<BeepEnable>on</BeepEnable>
<DeviceName>Katie AC</DeviceName>
<WifiVer>1</WifiVer>
</statusUpdateMsg>
</msg>
I also could find out that the AC is sending a broadcast message every two seconds of this kind:
<message msgid="Declaration">
<DevName>Katie AC</DevName>
<DevType>AirCond</DevType>
<DevMAC>34ea34799d0b_DEVICE</DevMAC>
<DevIP>192.168.1.108</DevIP>
<DevPort>7777</DevPort>
<DevLock>off</DevLock>
<DevHidden>off</DevHidden>
<Presence>on</Presence>
</message>
And when it is switched on you get the same thing plus some messages like the following at least one every 6 seconds (some of them may come even more frequently):
<msg msgid="statusUpdateMsg" type="Notify" seq="1234">
<statusUpdateMsg>
<BaseMode>selfFeel</BaseMode>
<TurnOn>on</TurnOn>
<SetTemp>61</SetTemp>
<WindSpeed>Auto</WindSpeed>
<IndoorTemp>66</IndoorTemp>
</statusUpdateMsg>
</msg>
I hope this is enough info to let us continue working on this component.
What address is the broadcast sent to?
Iāve updated the seq on gist.
Hi @fredrike and @pavlo,
The broadcast is to all the network (255.255.255.255), is that your question @fredrike?
Thanks
Yes. And itās sent to port 7777?
Iām not planning to implement the broadcast support (it might change though) my plan was to help you out with a working base and then you can glue parts of other implementations together to support local push and auto discovery.
Do you need support for more than on AC unit? Because that should be fairly easy to fix.
Iāll take a look in updating the code with complete settings with every update as that seems to be the best way according to @pavlo.
Hi @fredrike,
Donāt know if this help but I think there is a little problem (see log)
2019-01-31 21:03:07 WARNING (SyncWorker_14) [custom_components.climate.tfiac] Sending message: b'<msg msgid="SyncStatusReq" type="Control" seq="1548968587006">\n<SyncStatusReq></SyncStatusReq></msg>'
2019-01-31 21:03:07 WARNING (SyncWorker_14) [custom_components.climate.tfiac] Current status {'BaseMode': 'heat', 'TurnOn': 'off', 'Opt_display': 'on', 'Opt_ECO': 'off', 'Opt_super': 'off', 'SetTemp': '73', 'WindSpeed': 'Auto', 'Degree_Half': 'off', 'Opt_healthy': 'off', 'Opt_antiMildew': 'off', 'Opt_StereoWind': 'off', 'Opt_heating': 'off', 'Countdown_Timer_Off': '00:00', 'Countdown_Timer_On': '00:00', 'Infrared_Direct': 'off', 'Infrared_TurnOn': 'off', 'HumidityEnable': 'off', 'CleannessEnable': 'off', 'WindDirection_H': 'off', 'WindDirection_V': 'on', 'IndoorTemp': '63', 'Opt_sleepMode': 'off:0:0:0:0:0:0:0:0:0:0', 'BeepEnable': 'off', 'DeviceName': 'TAC_E88C95', 'WifiVer': '1'}
2019-01-31 21:03:08 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 287, in _handle_service_platform_call
await getattr(entity, func)(**data)
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/climate/__init__.py", line 506, in turn_off
raise NotImplementedError()
NotImplementedError
First I canāt connect the unit because I never see the command to power on it, I think itās best to send always the <TurnOn>on</TurnOn>
parameter and in that case we are assured that even if the AC unit of off it will ON in case a new state is sended (donāt know what you and @pavlo think about this approach).
Second I see there is a line break being sent in the message \n
(just before the <SyncStatusReq>
)
There is also a error in Python, donāt know if matters but I send it to you.
And by the way very thanks, for someone who donāt have a AC unit like that you are doing an amazing job! Thanks
Iāve updated the gist now, with what I believe could be the best way to send commands and control the AC unit.
The following XML is generated and sent (without \n
and spaces) Iāve added WindSpeed
to the message and hope that does not break the whole command:
<msg msgid="SetMessage" type="Control" seq="1549016192340">
<SetMessage>
<TurnOn>on</TurnOn>
<BaseMode>heat</BaseMode>
<SetTemp>74</SetTemp>
<WindSpeed>Low</WindSpeed>
</SetMessage>
</msg>
And:
<msg msgid="SetMessage" type="Control" seq="23">
<SetMessage>
<WindDirection_H>on</WindDirection_H>
<WindDirection_V>on</WindDirection_V>
</SetMessage>
</msg>
If I understand you correct are the status updates working.
During this weekend I will try to send the following message:
<msg msgid="SetMessage" type="Control" seq="1549016192340">
<SetMessage>
<TurnOn>on</TurnOn>
<BaseMode>heat</BaseMode>
<SetTemp>74</SetTemp>
<WindSpeed>Low</WindSpeed>
<WindDirection_H>on</WindDirection_H>
<WindDirection_V>on</WindDirection_V>
</SetMessage>
</msg>
So you can send the whole thing in only one message.
BTW, could you move the gist code to github repo where I can do a fork and then a pull request. I may have some time this weekend to do some improvements in the code.
You mean something like this https://github.com/fredrike/home-assistant/blob/tfiac/homeassistant/components/climate/tfiac.py (might have bet you by 5 min or so).
That would actually make the code more complex, but it would be nice to just have one message to send.
@krash I got a custom component already working. It is a preview version but it seems to work fine. Let me know if you want to test it. It may be helpful for us to squash some bugs.
@fredrike and I are still working in the component.
Hey @pavlo i would definately love to help out, my coding knowledge is limited but iāll do whatever i can.
Also, iām mainly using the units remotely, meaning my Hassio is in different place than the a/c units, will it still work?
I highly doubt that the implementation we have now will work on different networks.
Unless you have a VPN connection to the network where your a/c units are located, or you open an UDP port in your router to access your a/c units from internet, @fredrike is right it wonāt work in different networks. The option of openning a port would be very insecure.
What about installing a local home assistant where your ac units are located? You just need a new Raspberry Pi, then you can think of connecting two different home assistants.
With an raspberry-pi as gateway at the ādifferent placeā you could set up a UDP port forwarding tunnel and reach your unit remotely.