thecowan / wallpanel-android

WallPanel is an Android application for Web Based Dashboards and Home Automation Platforms
https://wallpanel.app
Apache License 2.0
745 stars 103 forks source link

Multiple identical state mqtt messages on start/page load #65

Closed akasma74 closed 5 years ago

akasma74 commented 5 years ago

Describe the bug Multiple identical state mqtt messages on Dashboard start

To Reproduce Subscribe to all mqtt topics, enable MQTT in WallPanel settings and open Dashboard. You will get something like this

11:37:26: (0) home/wallpanel/entrance/state {"currentUrl":"http:\/\/192.168.0.34:8123\/alarm","screenOn":true,"brightness":56} 11:37:26: (0) home/wallpanel/entrance/state {"currentUrl":"http:\/\/192.168.0.34:8123\/alarm","screenOn":true,"brightness":56} 11:37:27: (0) home/wallpanel/entrance/state {"currentUrl":"http:\/\/192.168.0.34:8123\/alarm","screenOn":true,"brightness":56} 11:37:27: (0) home/wallpanel/entrance/state {"currentUrl":"http:\/\/192.168.0.34:8123\/alarm","screenOn":true,"brightness":56} 11:37:28: (0) home/wallpanel/entrance/state {"currentUrl":"http:\/\/192.168.0.34:8123\/alarm","screenOn":true,"brightness":56} 11:37:28: (0) home/wallpanel/entrance/state {"currentUrl":"http:\/\/192.168.0.34:8123\/alarm","screenOn":true,"brightness":56} 11:37:30: (0) home/wallpanel/entrance/state {"currentUrl":"http:\/\/192.168.0.34:8123\/alarm","screenOn":true,"brightness":56} 11:37:32: (0) home/OpenMQTTGateway/433toMQTT {"value":75,"protocol":8,"length":12,"delay":698} 11:37:51: (0) home/wallpanel/entrance/state {"currentUrl":"http:\/\/192.168.0.34:8123\/alarm","screenOn":true,"brightness":56} 11:37:51: (0) home/wallpanel/entrance/sensor/motion {"value":false} 11:37:51: (0) home/wallpanel/entrance/state {"currentUrl":"http:\/\/192.168.0.34:8123\/alarm","screenOn":true,"brightness":56}

Expected behavior There should be only one state message. Also, it would be great to update docs as there is nothing about "brightness" in there.

Smartphone (please complete the following information): Acer Iconia One 7 WallPanel 0.8.5beta6

thanksmister commented 5 years ago

There are two items in the documentation about brightness, one is the command to set the brightness using MQTT (https://github.com/thanksmister/wallpanel-android#commands). The other is to receive application states (https://github.com/thanksmister/wallpanel-android/blob/master/README.md#application-state-data). I added brightness to the documentation, but screenOn and currentUrl are in the documentation.

thanksmister commented 5 years ago

These events are published any the screen is on, screen is off, or the user is present.

thanksmister commented 5 years ago

It seems these events are happening by design, they may seem a lot, but the state is published on the application start for the events that occur, so if you launch the app and touch it, you get two events, of if you change the url, touch the app, power off the screen you get three sets.

I have updated the documentation about the brightness value, which is your current screen brightness when the application state is published. However, at this time I won't address this issue as the states being published is minimal traffic.