Netatmo Binding 1.8.1 Outdoor RfStatus not showing a value any longer (solved)

Hi,

Sicne upgrading to 1.8.1 I can’t see any value for the outdoor module’s Rfstatus any longer. No changes have been made in the Netatmo .items file or sitemap. All other values show uop fine.

Does this happen to others as well?

Thanks

I think it was fixed very recently.

Do you have upper case characters for your device or module ids? The PR https://github.com/openhab/openhab/pull/3964 fixes the issue described with the defect: https://github.com/openhab/openhab/issues/3891

The device and module IDs are all lower case.

What also puzzles me, is that the events.log shows

Netatmo_Outdoor_RFstatus state updated to 0

while the Netatmo site settings show it should be 2/5.

Creating the logging from your suggestion in the PR gives me

… ,rfStatus=89, …

I managed to get the values showing again by eliminating a sitemap label conflict which didn’t seem to have thrown an exception before 1.8.

So I’m now getting “0 / 5” when expecting “2 / 5”

Any ideas with the above information?

Thanks

I just checked my 1.8.1 environment and I see a 4 / 5 for RF status. When I check the parameters in the netatmo application, the level is at 2 from 5.

WiFi signal is at 1 / 4 in OH while at 3 from 4 in netatmo.

looking at the RfStatus code at: https://github.com/openhab/openhab/blob/1.8/bundles/binding/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/messages/GetStationsDataResponse.java#L553:

/**
 * <code>rf_status</code> threshold constant: low signal
 */
private static final int RF_STATUS_THRESHOLD_0 = 90;

/**
 * <code>rf_status</code> threshold constant: medium signal
 */
private static final int RF_STATUS_THRESHOLD_1 = 80;

/**
 * <code>rf_status</code> threshold constant: high signal
 */
private static final int RF_STATUS_THRESHOLD_2 = 70;

/**
 * <code>rf_status</code> threshold constant: full signal
 */
private static final int RF_STATUS_THRESHOLD_3 = 60;

public int getRfLevel() {
    int level = this.rfStatus.intValue();
    int result = 4; // not found

    if (level < RF_STATUS_THRESHOLD_3)
        result = 3;
    else if (level < RF_STATUS_THRESHOLD_2)
        result = 2;
    else if (level < RF_STATUS_THRESHOLD_1)
        result = 1;
    else if (level < RF_STATUS_THRESHOLD_0)
        result = 0;

    return result;
}

Which basically is:

< 60  result = 3
60-69 result = 2
70-79 result = 1
80-89 result = 0
>= 90 result = 4

So when rfStatus is 89, it should be returning 0. In my case, I have 2 modules and I have rfStatus values of 63 and 64, OH is returning 2 and Netatmo is showing 4 out of 5 bars. As why it works this way, I don’t know, it looks like this code has been this way for well over a year, and possibly since the binding was initially created. I’m also seeing different results for wifi between OH and Netatmo.

It appears these values came from the Netatmo api documentation: https://dev.netatmo.com/doc/methods/getstationsdata. Search for rf_status.

API not really clear but I would assume
<= 60 full signal meaning 5
<= 70 signal higjh meaning 4
<= 80 signal medium meaning 3
<= 90 low signal meaning 2
And > 90 meaning 1

And for WiFi I would assume
<= 56 meaning 4
<= 71 meaning 3
<= 86 meaning 2
And > 86 meaning 1

@Lolodomo, Yes I agree. Maybe you can create both a defect and a PR to fix both rfstatus and wifi? We’ll also want to tag clinique (Gaël L’hopital) in the PR so he can make the similar changes in the OH2 binding. I tried to tag him here, but could’t find him.

BTW, can you make sense of the logic for battery level? https://github.com/openhab/openhab/blob/1.8/bundles/binding/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/messages/GetStationsDataResponse.java#L599, I added in support for wind, but left the logic as is.

Thanks, having a look at the API docs as well, with

class NARadioRssiTreshold
{
const RADIO_THRESHOLD_0 = 90;/low signal/
const RADIO_THRESHOLD_1 = 80;/signal medium/
const RADIO_THRESHOLD_2 = 70;/signal high/
const RADIO_THRESHOLD_3 = 60;/full signal/
}

I agree with Lolodomo, that it should be

<= 60 full signal meaning 5
<= 70 signal higjh meaning 4
<= 80 signal medium meaning 3
<= 90 low signal meaning 2
And > 90 meaning 1

With the current RfStatus code

/**

  • rf_status threshold constant: low signal
    */
    private static final int RF_STATUS_THRESHOLD_0 = 90;

/**

  • rf_status threshold constant: medium signal
    */
    private static final int RF_STATUS_THRESHOLD_1 = 80;

/**

  • rf_status threshold constant: high signal
    */
    private static final int RF_STATUS_THRESHOLD_2 = 70;

/**

  • rf_status threshold constant: full signal
    */
    private static final int RF_STATUS_THRESHOLD_3 = 60;

public int getRfLevel() {
int level = this.rfStatus.intValue();
int result = 4; // not found

if (level < RF_STATUS_THRESHOLD_3)
    result = 3;
else if (level < RF_STATUS_THRESHOLD_2)
    result = 2;
else if (level < RF_STATUS_THRESHOLD_1)
    result = 1;
else if (level < RF_STATUS_THRESHOLD_0)
    result = 0;

return result;

}

the highest possible return value is 3, save for the 4 - not found, and there’d never be a full 5/5, even with a very good signal. Also having the private static final int RF_STATUS_THRESHOLD_0 = 90;, shouldn\t this only be triggered if it is above 90, not < RF_STATUS_THRESHOLD_0.

public int getRfLevel() {
int level = this.rfStatus.intValue();
int result = 0; // not found

if (level <= RF_STATUS_THRESHOLD_3)
    result = 5;
else if (level <= RF_STATUS_THRESHOLD_2)
    result =4;
else if (level <= RF_STATUS_THRESHOLD_1)
    result = 3;
else if (level <= RF_STATUS_THRESHOLD_0)
    result = 2;

else if (level > RF_STATUS_THRESHOLD_0)
result = 1;

return result;

}

should give the same results as on the Netatmo site itself

<= 60 full signal meaning 5
<= 70 signal higjh meaning 4
<= 80 signal medium meaning 3
<= 90 low signal meaning 2
And > 90 meaning 1

with 0 actually only showing up if the raio signal has been lost/not found, and my rfStatus=89 showing the same 2 signal strength.

What I am not sure is if we should consider <= or < ?

I can provide a fix but not today.

Yes, I’m wondering about that as well, but from you suggestion

<= 60 full signal meaning 5
<= 70 signal higjh meaning 4
<= 80 signal medium meaning 3
<= 90 low signal meaning 2
And > 90 meaning 1

and me assuming the same I took <= for the time being. It would be nice to see how Netatmo actually interprets the threshold values themselves and use the same functionality.

Anybody with an exact 60, 70, 80 or 90 value, to see how it is represented on the Netatmo site? :wink:

I have time today, so I can create a fix, and combine it with my other PR that is still outstanding. Based on the documentation I’d interpret it as <= instead of <

Many thanks Lolodomo and ranielsen!

Seeing big discrepancies in the Indoor WiFi signal as well, I suppose the current

public int getWifiLevel() {
int level = this.wifiStatus.intValue();
int result = 3;
if (level < WIFI_STATUS_THRESHOLD_2)
result = 2;
else if (level < WIFI_STATUS_THRESHOLD_1)
result = 1;
else if (level < WIFI_STATUS_THRESHOLD_0)
result = 0;

        return result;
    }

should be

public int getWifiLevel() {
int level = this.wifiStatus.intValue();
int result = 0;
if (level <= WIFI_STATUS_THRESHOLD_2)
result = 4;
else if (level <= WIFI_STATUS_THRESHOLD_1)
result = 3;
else if (level <= WIFI_STATUS_THRESHOLD_0)
result = 2;
else if (level > WIFI_STATUS_THRESHOLD_0)
result = 1;

        return result;
    }

as well for a correct WiFi signal display.

P.S. as Lolodomo already mentioned above - my bad.

I updated PR https://github.com/openhab/openhab/pull/3964 with a fix.

Thank you.
I will test as soon as the nightly build includes this PR.

Can you try out the cloudbees build: https://openhab.ci.cloudbees.com/job/PR-openHAB1-Addons/168/

1 Like

My only remaning suggestion for consistency would be to have a <= as well in


} else if (level < RF_STATUS_LOW_SIGNAL) {
result = 2;
}

->


} else if (level <= RF_STATUS_LOW_SIGNAL) {
result = 2;
}

EDIT: Just saw this has already been addressed :slightly_smiling:

1 Like