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

新的智能開關 #5

Open
846637834 opened this issue Sep 15, 2024 · 47 comments
Open

新的智能開關 #5

846637834 opened this issue Sep 15, 2024 · 47 comments

Comments

@846637834
Copy link

請問之後有機會支援新的智能開關嗎

@tsunglung
Copy link
Owner

Need switch parameter.

@chc919
Copy link

chc919 commented Nov 10, 2024

Does these help? The model is WTYGF-540207H.
IOT智慧開關(雙),I have single as well. Please let me know if you need it. Thanks.
panasonic_commands.json
panasonic_devices.json

@tsunglung
Copy link
Owner

Please help to test the latest commit.

@chc919
Copy link

chc919 commented Nov 11, 2024

I'm having an issue while installing the latest commit.
HA Core: 2024.11.1
Frontend:2 0241106.2

ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration panasonic_ems2: Exception importing custom_components.panasonic_ems2.config_flow

@chc919
Copy link

chc919 commented Nov 11, 2024

2024-11-11 22:36:23 Traceback (most recent call last):
2024-11-11 22:36:23 File "/usr/src/homeassistant/homeassistant/loader.py", line 1268, in _load_platform
2024-11-11 22:36:23 cache[full_name] = self._import_platform(platform_name)
2024-11-11 22:36:23 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-11 22:36:23 File "/usr/src/homeassistant/homeassistant/loader.py", line 1300, in _import_platform
2024-11-11 22:36:23 return importlib.import_module(f"{self.pkg_path}.{platform_name}")
2024-11-11 22:36:23 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-11 22:36:23 File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
2024-11-11 22:36:23 return func(*args, **kwargs)
2024-11-11 22:36:23 ^^^^^^^^^^^^^^^^^^^^^
2024-11-11 22:36:23 File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module
2024-11-11 22:36:23 return _bootstrap._gcd_import(name[level:], package, level)
2024-11-11 22:36:23 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-11 22:36:23 File "", line 1387, in _gcd_import
2024-11-11 22:36:23 File "", line 1360, in _find_and_load
2024-11-11 22:36:23 File "", line 1310, in _find_and_load_unlocked
2024-11-11 22:36:23 File "", line 488, in _call_with_frames_removed
2024-11-11 22:36:23 File "", line 1387, in _gcd_import
2024-11-11 22:36:23 File "", line 1360, in _find_and_load
2024-11-11 22:36:23 File "", line 1331, in _find_and_load_unlocked
2024-11-11 22:36:23 File "", line 935, in _load_unlocked
2024-11-11 22:36:23 File "", line 995, in exec_module
2024-11-11 22:36:23 File "", line 488, in _call_with_frames_removed
2024-11-11 22:36:23 File "/config/custom_components/panasonic_ems2/init.py", line 13, in
2024-11-11 22:36:23 from .core import PanasonicSmartHome
2024-11-11 22:36:23 File "/config/custom_components/panasonic_ems2/core/init.py", line 22, in
2024-11-11 22:36:23 from . import apis
2024-11-11 22:36:23 File "/config/custom_components/panasonic_ems2/core/apis.py", line 3, in
2024-11-11 22:36:23 from .const import BASE_URL
2024-11-11 22:36:23 File "/config/custom_components/panasonic_ems2/core/const.py", line 1663, in
2024-11-11 22:36:23 PanasonicSwitchDescription(
2024-11-11 22:36:23 TypeError: PanasonicSwitchDescription.init() got an unexpected keyword argument 'options'
2024-11-11 22:36:23 2024-11-11 22:36:23.779 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration panasonic_ems2: Exception importing custom_components.panasonic_ems2.config_flow

@chc919
Copy link

chc919 commented Nov 11, 2024

Tried to comment #1668 #1669 in file "/panasonic_ems2/core/const.py".
Install success and got the option but still not working.
Screenshot 2024-11-11 225519
image

@chc919
Copy link

chc919 commented Nov 11, 2024

Found an other issue that once integration loaded. The switch will be appeared as offline in Panasonic APP. The only way to fix is remove and add it again.

@chc919
Copy link

chc919 commented Nov 11, 2024

Latest commit 97137a5 facing the same issue.
No sevices oe entities and casused device offline from Panasonic APP. Looks very similar to issue #1

@tsunglung
Copy link
Owner

Can you try to comment #400 - #408 file "/panasonic_ems2/core/const.py"?
Test line by line with comment or remove.
Not sure which query command effect the device.

@chc919
Copy link

chc919 commented Nov 11, 2024

Can you try to comment #400 - #408 file "/panasonic_ems2/core/const.py"? Test line by line with comment or remove. Not sure which query command effect the device.

Line 401 "LIGHT_OPERATION_STATE" caused the issue.

@tsunglung
Copy link
Owner

What entities did you get after removed LIGHT_OPERATION_STATE?

@chc919
Copy link

chc919 commented Nov 12, 2024

Are you asking for these?
image
image

@tsunglung
Copy link
Owner

Is the status unavailable?

Is the switch is single channel?

@chc919
Copy link

chc919 commented Nov 12, 2024

It is available in Panasonic APP but not in HA.
The switch has two channels.

@tsunglung
Copy link
Owner

Can you update to the latest commit and check the entities of HA panasonic switch?

@chc919
Copy link

chc919 commented Nov 12, 2024

The latest commit show no deices or entities. And caused the swtich offline.

@tsunglung
Copy link
Owner

Strange. I didn't change the query commands. Can you help to remove #401-#408 of const.py?

@tsunglung
Copy link
Owner

Or please help to check the logs of HA if any logs related to. Panasonic_ems2

@chc919
Copy link

chc919 commented Nov 12, 2024

I didn't see any logs releated. Is there any debug mode I need to set up in advance?
After comments #401-#408, it shows as the following,
image

The switch works properly but it couldn't show the state (I guess they were commented?).
image
image

@tsunglung
Copy link
Owner

I move the query commands of switch to cloud.py (#439 - #444) depends on different switch mode.
Please help to check. If still get offline, please comment the lines #439-#444.

@tsunglung
Copy link
Owner

The switch works properly but it couldn't show the state (I guess they were commented?).

Work? You mean that you can control the switch but it did not show the state?

The state of query command was not removed, so the state of the switch shall be reported.

@chc919
Copy link

chc919 commented Nov 13, 2024

The switch works properly but it couldn't show the state (I guess they were commented?).

Work? You mean that you can control the switch but it did not show the state?

The state of query command was not removed, so the state of the switch shall be reported.

Yes, I commented #401 - #408. I could control the switch but did not show the state.
I will try the latest commit tonight. Thanks.

@846637834
Copy link
Author

846637834 commented Nov 13, 2024

我也嘗試安裝了,一樣的問題,無法取得狀態。
可以操作switch但他對應的不是按鍵開關啟動與關閉,而是按鍵開啟設備進入維修狀況或是正常狀態。
如果我分享設備權限給您會有幫助嗎

@tsunglung
Copy link
Owner

tsunglung commented Nov 13, 2024

Share the device is best way to speed up the debugging process.
I can better to know the response of the query commands and the effect of query commands.

@846637834
Copy link
Author

846637834 commented Nov 13, 2024

(Removed)
Here is QRcode, if you added, pls let me know, I will revmoe the photo later, thanks!

@chc919
Copy link

chc919 commented Nov 13, 2024

I could also share my switch with you tonight when I back home.
@846637834 while it may caused the device offline in certain situation and need to reset the switch. Is it okay for you?

@tsunglung
Copy link
Owner

(Removed)
Here is QRcode, if you added, pls let me know, I will revmoe the photo later, thanks!

Thanks.
I added the switches.

@tsunglung
Copy link
Owner

tsunglung commented Nov 13, 2024

I fix the issue that the state of the switch type is not update. Please help to test.
Notice that the limitation of api access quote, the state update is not real time.

@chc919
Copy link

chc919 commented Nov 13, 2024

Test report from my side with 二迴路開關
迴路一:control (OK) / state (NG)
迴路二:control (OK) / state (OK)

@chc919
Copy link

chc919 commented Nov 13, 2024

Removed
QR Code share for you to test. I'm not using it. You could change the state anytime. Thanks.

@tsunglung
Copy link
Owner

Removed
QR Code share for you to test. I'm not using it. You could change the state anytime. Thanks.

Ok, thanks

@846637834
Copy link
Author

There is one intersting thing, I can select the device F540107/F540207/F540307 when I import, however only F540107 I can find in the summary.

image
image

@846637834
Copy link
Author

I test the switch.
It can control now. State works also.
But I can only test F540107

@tsunglung
Copy link
Owner

There is one intersting thing, I can select the device F540107/F540207/F540307 when I import, however only F540107 I can find in the summary.

Your two channels and three channels switch are offline. You need to restart it.

@tsunglung
Copy link
Owner

Test report from my side with 二迴路開關 迴路一:control (OK) / state (NG) 迴路二:control (OK) / state (OK)

Checking

@tsunglung
Copy link
Owner

@chc919 @846637834
Because I am doing querying commands test, your switches are offline. Can you help to restart them?

@chc919
Copy link

chc919 commented Nov 13, 2024

@chc919 @846637834 Because I am doing querying commands test, your switches are offline. Can you help to restart them?

Restarted.

@tsunglung
Copy link
Owner

tsunglung commented Nov 13, 2024

After guessed the logic of switches for several times, the state and control of the switches shall be ok now.
I have to say the engineers of Panasonic IoT TW are genius.

@846637834
Copy link
Author

Restarted.

@chc919
Copy link

chc919 commented Nov 14, 2024

After several tests, the control works properly. The only thing not change real time is 全迴路運轉狀態. However, it will change after a while. Is there any limitation? (By the way, is the status shown as binary to decimal?)
時間到開/時間到關 is shown as disabled in the status. Shall I expect it as disabled?
Thanks.

@tsunglung
Copy link
Owner

Do you mean the state of this entity?
The state of entity is not real time because the integration is using polling mode to query the state. The limit polling interval is 96second to avoid your IP been and by Panasonic cloud.

These entities "timer to on" and "timer to off" are disabled because I think that you can use HA automation to do the same job.

@chc919
Copy link

chc919 commented Nov 14, 2024

Do you mean the state of this entity? The state of entity is not real time because the integration is using polling mode to query the state. The limit polling interval is 96second to avoid your IP been and by Panasonic cloud.

These entities "timer to on" and "timer to off" are disabled because I think that you can use HA automation to do the same job.

Yes, it show as 3 when both circuits are on. And 1 or 2 for single on. I guess they are binary logic?

Sure, automation do the same thing, just want to make sure it is as it expected.

@tsunglung
Copy link
Owner

Binary logic.

options=["All Off", "Channel 1 On", "Channel 2 On", "Channel 1, 2 On", "Channel 3 On", "Channel 1, 3 On", "Channel 2, 3 On", "All On"],
options_value=["0", "1", "2", "3", "4", "5", "6", "7"],

@chc919
Copy link

chc919 commented Nov 14, 2024

Binary logic.

options=["All Off", "Channel 1 On", "Channel 2 On", "Channel 1, 2 On", "Channel 3 On", "Channel 1, 3 On", "Channel 2, 3 On", "All On"], options_value=["0", "1", "2", "3", "4", "5", "6", "7"],

Thanks!

The test result from my side suggest this issue could be close. Maybe we can wait for @846637834 's report while he/she has more switched on line.

@846637834
Copy link
Author

I test it, and the singal as what the binary logic showed.

@chc919
Copy link

chc919 commented Nov 17, 2024

I had one issue regarding to automation for switchs.
The HA gets the status change very late so the automation take action very late as well. Is there any way to improve or it is the API query limitation?
Thanks.

@tsunglung
Copy link
Owner

The API query limitation.

This integration is using polling to query the status of the devices and the maximal API access is 150 per hour.
So the minimum of the update interval is 96seconds.

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

3 participants