Skip to content

Commit

Permalink
[jeelink] Do not propagate state changes when sensor things are offli…
Browse files Browse the repository at this point in the history
…ne. (openhab#2777)

Signed-off-by: Volker Bier <[email protected]>
  • Loading branch information
vbier authored and martinvw committed Oct 12, 2017
1 parent cfe708f commit a099a45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import org.eclipse.smarthome.core.library.types.DecimalType;
import org.eclipse.smarthome.core.thing.Thing;
import org.eclipse.smarthome.core.thing.ThingStatus;
import org.openhab.binding.jeelink.internal.JeeLinkSensorHandler;
import org.openhab.binding.jeelink.internal.ReadingPublisher;
import org.openhab.binding.jeelink.internal.RollingAveragePublisher;
Expand Down Expand Up @@ -45,7 +46,7 @@ public ReadingPublisher<Ec3kReading> createPublisher() {
ReadingPublisher<Ec3kReading> publisher = new ReadingPublisher<Ec3kReading>() {
@Override
public void publish(Ec3kReading reading) {
if (reading != null) {
if (reading != null && getThing().getStatus() == ThingStatus.ONLINE) {
BigDecimal currentWatt = new BigDecimal(reading.getCurrentWatt()).setScale(1, RoundingMode.HALF_UP);
BigDecimal maxWatt = new BigDecimal(reading.getMaxWatt()).setScale(1, RoundingMode.HALF_UP);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.eclipse.smarthome.core.library.types.DecimalType;
import org.eclipse.smarthome.core.library.types.OnOffType;
import org.eclipse.smarthome.core.thing.Thing;
import org.eclipse.smarthome.core.thing.ThingStatus;
import org.openhab.binding.jeelink.internal.JeeLinkSensorHandler;
import org.openhab.binding.jeelink.internal.ReadingPublisher;
import org.openhab.binding.jeelink.internal.RollingAveragePublisher;
Expand Down Expand Up @@ -46,7 +47,7 @@ public ReadingPublisher<LaCrosseTemperatureReading> createPublisher() {
ReadingPublisher<LaCrosseTemperatureReading> publisher = new ReadingPublisher<LaCrosseTemperatureReading>() {
@Override
public void publish(LaCrosseTemperatureReading reading) {
if (reading != null) {
if (reading != null && getThing().getStatus() == ThingStatus.ONLINE) {
BigDecimal temp = new BigDecimal(reading.getTemperature()).setScale(1, RoundingMode.HALF_UP);

logger.debug(
Expand Down

0 comments on commit a099a45

Please sign in to comment.