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

Support new device "Blind" and suppy device statistics #34

Merged
merged 8 commits into from
Dec 4, 2021
Merged

Support new device "Blind" and suppy device statistics #34

merged 8 commits into from
Dec 4, 2021

Conversation

JunkerMartin
Copy link
Contributor

AVM supports a new device "Blind". The companies "Becker" (BoxCTRL) and "Rademacher" (Rollotron DECT 1213) supply the hardware for this. The "getdevicelist" fails because the xml provided by the fritzbox cannot be marshalled to a DeviceList-object. There is no class "Blind", so the tag cannot become instantiated.

The statistic retrieval in TestDriver ist commented out. When I tried, I found it failing due to unsupported commands. I added retrieval of statistics by adding (or updating) the classes "DeviceStats", "Statistics", "Energy", "Power", "Humidity" and "Voltage" (and some helping classes). I also added a JUnit-Test for marshalling the statistics.
The code has been developed by the samples I got when retrieving the data. I'm not sure, whether to docu provided with "AVM Home Automation HTTP Interface" contains really all what is to be known about this. I fear, that, under some cirumstances there might come up another xml-tag which again will fail the marshalling. It looks more like a draft document.

I have added displaying of energy-statistics and power statistics to the sample "TestDriver"

JunkerMartin added 4 commits November 22, 2021 10:33
added missing element "Alert" to "Device"
Fixed NPE when "switchstate" is null in "Device"
…ow can get the normalized values, does not need to calculate by itself
Copy link
Owner

@kaklakariada kaklakariada left a comment

Choose a reason for hiding this comment

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

Thank you very much for your pull request! I am happy to merge it when you fix my review findings.

build.gradle Outdated
@@ -44,6 +44,7 @@ dependencies {
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
implementation 'com.subshell.simpleframework:simple-xml:2.9.0'
implementation 'org.slf4j:slf4j-api:1.7.32'
implementation 'org.apache.commons:commons-lang3:3.12.0'
Copy link
Owner

Choose a reason for hiding this comment

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

Please avoid adding dependencies. If necessary implement the necessary methods here.

Additional dependencies increase the attack surface in case they contain vulnerabilities. We are responsible to fix/upgrade when we use them.

@@ -0,0 +1,15 @@
<devicestats>
<temperature>
<stats count="96" grid="900">185,185,185,185,180,175,175,180,180,185,180,180,180,175,180,180,175,175,175,175,175,175,175,175,175,175,175,175,180,180,180,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195</stats>
Copy link
Owner

Choose a reason for hiding this comment

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

Please add tests for parsing a devicestats file

Copy link
Owner

@kaklakariada kaklakariada left a comment

Choose a reason for hiding this comment

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

Thank you for your changes!
Could you please address the remaining issues:

  • Replace dependency to commons-lang3
  • Add unit tests for statistics
  • Fix failing CI build

@kaklakariada
Copy link
Owner

There are still some issues with the PR. I will merge it and fix the issues myself.

@kaklakariada kaklakariada merged commit e06cb65 into kaklakariada:master Dec 4, 2021
@kaklakariada kaklakariada mentioned this pull request Dec 4, 2021
kaklakariada added a commit that referenced this pull request Dec 4, 2021
@kaklakariada
Copy link
Owner

I created release 1.5.0 and published it to Maven Central. It should be available soon at https://repo1.maven.org/maven2/com/github/kaklakariada/fritzbox-java-api/1.5.0/

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

Successfully merging this pull request may close these issues.

2 participants