Replies: 26 comments 92 replies
-
I pass all those problematic stuff to the Switcher devs. |
Beta Was this translation helpful? Give feedback.
-
So this is Switcher's reply: Regarding (1), They say that this Token is part of ensuring security as Runners are different from other "Normal" Switcher devices as they are more sensitive and we don't want attackers accessing our Runners remotely and messing with our house. They wanted to verify again that this Token is "Local Only" and not accessing the Switcher server by any means. About having an API call to get the Token - This is not possible because this will break the meaning of this Token to validate the user requiring the Token. Regarding HA stuff, They say that they can have an API call that gets the account owner's email and the Token is sent by email. Regarding (2), They say they probably can solve that and share the knowledge of the Token required by the device and firmware. I want to mention that Daniel the Owner of Switcher is trying to contact you guys and opened a WhatsApp group, So please get back to them. |
Beta Was this translation helpful? Give feedback.
-
Sorry, haven't had the time to go over this yet. I'll make some time this weekend. |
Beta Was this translation helpful? Give feedback.
-
That would probably be the only clean option, since current implementation is async mixing the TCP & UDP is something we should avoid.
|
Beta Was this translation helpful? Give feedback.
-
I am having issues with rebasing runner-support.. I made this branch "runner-support-fixed" (Future PR for integrating to dev: #744) which is dev + the changes in runner-support. |
Beta Was this translation helpful? Give feedback.
-
So let's get back to the Token part. So we agreed that the Token logic is essential for the Switcher team to ensure better security controlling our devices. What does the token logic affect? it added new packets that need to be sent to the devices that are using the token. So we have different packets sent between a device that uses a Token and one without it. The issue starts here where on the "set_position" part for example we are currently sending "DeviceType.RUNNER" as a type but this should be based on the actual device type (https://github.com/TomerFi/aioswitcher/blob/dev/src/aioswitcher/api/__init__.py#L716-L727) Currently, the only devices that need Token no matter which version are: Switcher Runner S11, Switcher Runner S12, and all Switcher Lights. Therefore, in the current state of the operating function, we don't know which device it is and we are unable to "choose" the correct packets to send. Also knowing the device_type like this will also solve this kind of issue #335 |
Beta Was this translation helpful? Give feedback.
-
@TomerFi @thecode Update:
Regarding all of that, it is safe to say that we can apply the Token logic based on the user's owned devices. |
Beta Was this translation helpful? Give feedback.
-
I asked them about it in the past they said it is possible but we didn't listen to the port the device advertise the firmware version (which I think we already added to the ports we listen, so I have some worries about the validity of the answers you get from them. I must say I am not happy with all this process, it is enough to read this discussion and see that there are contradictory answers already here. Uses who asked them also got confusing answers. I also don't understand how they will deal with it in their app, even if it will take a year they would still need to address different firmware capabilities. The App knows the device firmware and I assume they are not guessing it. I would still recommend you ask them (just send the questions and paste the answer here as it is):
However since you are eager to push this implementation if you want to add a flag which will be sent with the device discovery data that will mark if the device needs token you can go ahead with this implementation. |
Beta Was this translation helpful? Give feedback.
-
I Haven't changed my phone and didn't have a call from them for almost two years. My last question on our WhatsApp group from two years ago is still waiting an answer but that is not relevant now.
No, I think it should just be hardcoded part of the device type, see here: aioswitcher/src/aioswitcher/device/__init__.py Lines 38 to 46 in 6b477af Options:
I am getting confused again, didn't you just mention "Right now, Only Switcher Runner S11, Switcher Runner S12 and Switcher Lights require a Token" and "The only plan right now is to add a Token logic to the Switcher Runner (once again at least 1 year from now)."? This was the base assumption why we go forward without knowing the token logic, all of the above are Api2 devices, so how come we discuss Api1 again? I think you need to clear those things up. As for the token, if you go with option 1, make the token an optional parameter for Api2 (token: str | None = None) if you go with option 2 add a new required parameter. |
Beta Was this translation helpful? Give feedback.
-
But then it would only work for HA.. This library would be broken.. |
Beta Was this translation helpful? Give feedback.
-
But you are talking about discovery time. This library can directly reach device operations without any discovery bridging.. it won't work here.. |
Beta Was this translation helpful? Give feedback.
-
You are missing the point. The discovery can tell you if you need a token or not, after that you don't need it anymore. Of course the library can do operations without discovery, but discovery needs to happen at least one time for a user to know the device details, than he can store and use them (without the need for discovery next time). The webapi users do the same, they run the discovery script, store the device id & ip and use it for their API calls (otherwise they need to guess the device ID somehow). |
Beta Was this translation helpful? Give feedback.
-
@thecode For the discovery here is an example: {
'device_id': '6442c6',
'device_key': '04',
'device_state': <DeviceState.ON: ('01', 'on')>,
'device_type': <DeviceType.RUNNER_S11: ('Switcher Runner S11', '0f01', 2, <DeviceCategory.SHUTTER_SINGLE_LIGHT_DUAL: 5>, True)>,
'direction': <ShutterDirection.SHUTTER_STOP: ('0000', 'stop')>,
'ip_address': '192.168.1.200',
'last_data_update': datetime.datetime(2024, 3, 24, 18, 4, 18, 992213),
'light': <LightState.OFF: ('00', 'off')>,
'light2': <LightState.OFF: ('00', 'off')>,
'mac_address': 'FH:41:3F:DA:26:3C',
'name': 'Switcher Runner_6CF5',
'position': 100,
'token_needed': True
} Is it ok that I added the "token_needed" field in the discovery? or we just use device_type.token_needed instead? Also, what is a better name for a function: "is_using_token" or "token_needed"? |
Beta Was this translation helpful? Give feedback.
-
@thecode @TomerFi The PR is based on this #744 |
Beta Was this translation helpful? Give feedback.
-
@thecode @thecode Me and the community will have to yet use the HomeBridge Switcher plugin to support those devices. |
Beta Was this translation helpful? Give feedback.
-
Yogev, please please bring the PR back! I know that like me there are many
other people anxiously waiting for this to happen already. Sure it took way
too long but we all saw how dedicated you were to this cause... This is a
really important feature, please reconsider and bring it back! Thank you so
much for all that you've done so far.
…On Fri, Apr 5, 2024, 01:48 Tomer Figenblat ***@***.***> wrote:
I'm sorry you feel that way. Please see this #747 (comment)
<#747 (comment)>
as an answer. If you change your mind and are willing to collaborate, I
still think we can make it work.
—
Reply to this email directly, view it on GitHub
<#715 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN25E3RUV7FFKZBKTYJ6QLY3XKDNAVCNFSM6AAAAAA5CHTQBKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TAMJVGE4DM>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I am splitting #747 into smaller PRs starting with #764. |
Beta Was this translation helpful? Give feedback.
-
@YogevBokobza @thecode We missed CI workflows not running for PR opened against a branch other than dev. Fixed in #765. Let's merge this. |
Beta Was this translation helpful? Give feedback.
-
thank you @YogevBokobza for all your hard work!!! |
Beta Was this translation helpful? Give feedback.
-
@TomerFi |
Beta Was this translation helpful? Give feedback.
-
@TomerFi @thecode The actual indexes used from those 2 functions are different between those 2 places and I will try to explain with an example.. So when controlling the device those are the outputs that need to be returned from the functions. But, for the discovery, it should take those indexes and subtract 1 from the returned functions. I have found 2 solutions for that:
NOTE: The updated code for controlling the device is not pushed yet and I am testing this locally with the actual device. Let me know what you think is better.. |
Beta Was this translation helpful? Give feedback.
-
I am taking a week off for vacation.. I will get back after that. |
Beta Was this translation helpful? Give feedback.
-
@TomerFi |
Beta Was this translation helpful? Give feedback.
-
@thecode
|
Beta Was this translation helpful? Give feedback.
-
@TomerFi |
Beta Was this translation helpful? Give feedback.
-
Description
Based on an investigation performed by @YogevBokobza, new Runner firmware versions require the use of a token.
Problems
Currently, it looks like the said token can only be fetched manually by accessing the vendor's servers. No API is currently available for programmatic access.
Not all firmware versions require the use to token, and for now it appears we don't have an out-of-the-box approach for determining which ones do.
This project has 2 main clients, Home Assistant Integration Switcher KIS and a Containerized WebAPI Switcher WebAPI. For the latter, including vendor server access will force a change of the integration class.
Guidelines
This project works locally only, multiple people have worked really hard along the years to make it possible with the goal of making the underlying PyPi module more robust. We should strive to keep it that way.
Home Assistant should be onboard with any change, everything needs to be in the spirit of HA. Although not the prefered path, but if not accepted by HA, splitting the PyPi module into 2 will be considered.
A target branch was created for for any related work, any PR should be based from runner-support.
This is an open discussion, anyone is welcome to comment and contribute. That being said, both the topic of adding support for new devices, and the topic of changing the class of HA integration can become a bit heated, it's important keep this project's Code of Conduct in mind, and assume good intentions by all.
Project PRs
More information can be found in the following PRs:
Client PRs
Contacts
Thanks are in order for all current and future involved. All the time and hard work invested in this are very much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions