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

[tr064] Add Wifi Signal Strength & Wifi Speed channels to LAN Subdevice #10959

Merged
merged 7 commits into from
Jul 31, 2021

Conversation

tobiloeb
Copy link
Contributor

@tobiloeb tobiloeb commented Jul 7, 2021

This PR adds three addional channels to the tr064 binding.
First: The IP Address of all given MAC Address (entered in MacOnline list configuration)
Second: The Wifi Signal Strength of all given MAC Address (entered in MacOnline list configuration)
Third: The Wifi Speed of all given MAC Address (3ntered in MacOnline list configuration)

The main goal of this additional channels is to determine the position of a device inside the house. The Wifi Signal Strength or Wifi Speed can be used to check where a device is currently located.

The WLAN Configuration of tr064 api offers multiple configurations ( 1,2,3 ) depending of the access points 2.4Ghz 5Ghz. So there are two channels for Signal Strength and Wifi Speed. One for the 2.4Ghz and one for the 5Ghz access point. See documentation here: https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/wlanconfigSCPD.pdf

I can't upload the .jar file with my changes. Where can I upload it? Otherwise just build the tr064 bundle and copy it to the addons folder in openhab. After restart the changes should appear.

If you have any further questions, let me know. 😃

Signed-off-by: Tobias Löbermann <tobiloeb@gmail.com>
@tobiloeb tobiloeb requested a review from a team as a code owner July 7, 2021 19:16
@Skinah
Copy link
Contributor

Skinah commented Jul 12, 2021

Can you use system.signal-strength channel? See link below and other bindings which are now implementing this to abstract the strength.

https://www.openhab.org/docs/developer/bindings/thing-xml.html#system-state-channel-types

@Skinah Skinah added the enhancement An enhancement or new feature for an existing add-on label Jul 13, 2021
@tobiloeb
Copy link
Contributor Author

tobiloeb commented Jul 13, 2021

@Skinah Thanks for your suggestion. If I got it right, the system.signal-strength channel describes the signal-strength of its thing. In my case the signal strength is not the signal strength of the subdevice (LANDevice) itself. The LANDevice (subdevice) includes all Lan & Wifi information and configuration from the AccessPoint (bridge). And it can give you information (e.g. signal strength and speed) for a given MAC address connected to the AccessPoint as well.
My MR adds the possibility to get the information about speed and strength for each MAC address added to the list in the configuration of the LANDevice. Currently you only have the MacOnline Channel for each entered MAC address.

I think the system.signal-strength wouldn't fit in this scenario, right?

@Skinah
Copy link
Contributor

Skinah commented Jul 15, 2021

Yes I believe system.signal-strength should be used.

@fwolter
Copy link
Member

fwolter commented Jul 25, 2021

I think system.signal-strength can be used here. But I won't insist on changing it. @Skinah @tobiloeb WDYT?

@tobiloeb
Copy link
Contributor Author

tobiloeb commented Jul 25, 2021

I think system.signal-strength can be used here. But I won't insist on changing it. @Skinah @tobiloeb WDYT?

I have read the documentation for the system channels, but didn't get everything from the concept and how to implement it in my case. For my usecase (and hopefully for some more people) it would be nice and enough to let it as is. 👍 :)

@fwolter
Copy link
Member

fwolter commented Jul 25, 2021

If there's a comprehension problem, don't hesitate to ask! It feels wrong to make a decision if there's some uncertainty.

@tobiloeb
Copy link
Contributor Author

If there's a comprehension problem, don't hesitate to ask! It feels wrong to make a decision if there's some uncertainty.

Yeah I got your point. For me there are two things:
When I use the sytem.signal-strength with vaules from 0 - 4 I will lose information cause now I have a range between 0 - 100. Nevertheless it should work in my case. But do I have to implement a mapper between the different ranges and where? And is it right to just change the type from "number" to "system.signal-strength"? Or is it required to add the channels to the thing-type definition? This confuses me, cause the signal strength of my added channels are not the signal strength of the tr064 LANDevice itself.

Thanks :)

@fwolter
Copy link
Member

fwolter commented Jul 25, 2021

In most cases you don't need high resolution for signal strengths. And in most cases you don't have the accuracy, too. That's why most wifi icons have five states or less. Yes, it's hard to map the original signal strength to the 0-4 scale, but if you don't do it, you leave it up to the user. I think you have better insights to do that, than the normal user.

To change it to system.signal-strength, simply set the channel type to system.signal-strength and keep it Number.

@Skinah
Copy link
Contributor

Skinah commented Jul 26, 2021

If you need an example to follow, look at the opensprinkler binding as I made the change a week or two ago and it is merged.
I don't care strongly either way, but would lean towards changing it. Currently the wifi icon does not change, but I'm guessing that if/when that is fixed then the user gets an animated icon showing the signal strength with the standard wifi icon. Also there may be a way to click on the semantic model to show all wifi strengths and view them all on the page with a common look. I have noticed that for battery levels and battery low, there are two system channels, shame there is not two for wifi strength, but really in 99% of cases the strength is not important and having persistance storing a tiny change in db over and over is not a smart thing IMHO. Actually that is another difference, you will not have persistance storing the values when you change the channel over to system.signal-strength.

@tobiloeb
Copy link
Contributor Author

Thanks for the explanation, I will take a look at your changes and adjust the channel type. Your points sounds good to me and make sense. I will set this PR to WIP and go on when I am ready.

@tobiloeb tobiloeb changed the title [tr064] Add Wifi Signal Strength & Wifi Speed channels to LAN Subdevice WIP: [tr064] Add Wifi Signal Strength & Wifi Speed channels to LAN Subdevice Jul 26, 2021
@tobiloeb tobiloeb changed the title WIP: [tr064] Add Wifi Signal Strength & Wifi Speed channels to LAN Subdevice [WIP][tr064] Add Wifi Signal Strength & Wifi Speed channels to LAN Subdevice Jul 26, 2021
Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>
Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>
@tobiloeb tobiloeb changed the title [WIP][tr064] Add Wifi Signal Strength & Wifi Speed channels to LAN Subdevice [tr064] Add Wifi Signal Strength & Wifi Speed channels to LAN Subdevice Jul 28, 2021
@tobiloeb
Copy link
Contributor Author

@fwolter Here is my update:
I have added the typeId to the macSignalStrength1 and macSignalStrength2 channels. I have decided to add the "typeId" attributes to the channel definition in channel.xml, cause all channels are configured there. It seems that this is a special case for the tr064 binding. All other bindings (as I can see) configure the channels in the thing-types.xml. For the tr064 binding there is a SOAPValueConverter and a concept of postProcessing. I used this concept to map the signalStrength values from range 0-100 to 0-4.

I have tested my changes and its woring fine. Is it right that the type is still "Number:Dimensionless"? Openhab is not showing the signalStrength Icon automatically?

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>
@tobiloeb tobiloeb changed the title [tr064] Add Wifi Signal Strength & Wifi Speed channels to LAN Subdevice [WIP][tr064] Add Wifi Signal Strength & Wifi Speed channels to LAN Subdevice Jul 29, 2021
Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>
@tobiloeb tobiloeb changed the title [WIP][tr064] Add Wifi Signal Strength & Wifi Speed channels to LAN Subdevice [tr064] Add Wifi Signal Strength & Wifi Speed channels to LAN Subdevice Jul 30, 2021
@tobiloeb
Copy link
Contributor Author

I have just testet a bit and made some code cleanings. I am using it in my openhab instance and its working well.

@fwolter, @Skinah From my perspective everythings is done. It would be great if you can take a look again. 😄 Thanks!

Copy link
Member

@fwolter fwolter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -119,6 +119,11 @@ The call-types are the same as provided by the FritzBox, i.e. `1` (inbound), `2`
| `wifi5GHzEnable` | `Switch` | | Enable/Disable the 5.0 GHz WiFi device. |
| `wifiGuestEnable` | `Switch` | | Enable/Disable the guest WiFi. |
| `macOnline` | `Switch` | x | Online status of the device with the given MAC |
| `macIP` | `String` | x | IP of the device with the given MAC |
| `macSignalStrength1` | `Number:Dimensionless` | x | Wifi Signal Strength of the device with the given MAC. This is set in case the Device is connected to 2.4Ghz |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the system channel type is of type Number, this needs to be Number, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right, I missed to update the readme documentation. The type for the channels is already of type Number.

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>
Copy link
Member

@fwolter fwolter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fwolter fwolter merged commit a1ec5eb into openhab:main Jul 31, 2021
@fwolter fwolter added this to the 3.2 milestone Jul 31, 2021
frederictobiasc pushed a commit to frederictobiasc/openhab-addons that referenced this pull request Oct 26, 2021
…ce (openhab#10959)

* Add channels to tr064

Signed-off-by: Tobias Löbermann <tobiloeb@gmail.com>

* Set typeId for macSignalStrength channels

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* adjust README with correct channel names.

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* Add JavaDoc and separate post processors.

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* Use UNDEF as default for signal-strength

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* Update README.md documentation

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>
thinkingstone pushed a commit to thinkingstone/openhab-addons that referenced this pull request Nov 7, 2021
…ce (openhab#10959)

* Add channels to tr064

Signed-off-by: Tobias Löbermann <tobiloeb@gmail.com>

* Set typeId for macSignalStrength channels

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* adjust README with correct channel names.

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* Add JavaDoc and separate post processors.

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* Use UNDEF as default for signal-strength

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* Update README.md documentation

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>
dschoepel pushed a commit to dschoepel/openhab-addons that referenced this pull request Nov 9, 2021
…ce (openhab#10959)

* Add channels to tr064

Signed-off-by: Tobias Löbermann <tobiloeb@gmail.com>

* Set typeId for macSignalStrength channels

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* adjust README with correct channel names.

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* Add JavaDoc and separate post processors.

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* Use UNDEF as default for signal-strength

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* Update README.md documentation

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>
Signed-off-by: Dave J Schoepel <dave@theschoepels.com>
marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this pull request May 5, 2022
…ce (openhab#10959)

* Add channels to tr064

Signed-off-by: Tobias Löbermann <tobiloeb@gmail.com>

* Set typeId for macSignalStrength channels

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* adjust README with correct channel names.

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* Add JavaDoc and separate post processors.

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* Use UNDEF as default for signal-strength

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>

* Update README.md documentation

Signed-off-by: Tobias Loebermann <tobiloeb@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants