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

Filter wind does not exists #2

Open
AndreTzerra opened this issue Jun 24, 2018 · 3 comments
Open

Filter wind does not exists #2

AndreTzerra opened this issue Jun 24, 2018 · 3 comments

Comments

@AndreTzerra
Copy link

Hello,

Since I added a additional indoor unit and updated the Netatmo firmware, the script is not working in the right way. After getting the 'rain' data I get the next error:

Name: Windmeter ID: XX:XX:XX:XX:XX:XX Last seen: 2018-06-24T06:59:54 Data types: ['Wind'] Traceback (most recent call last): File "netatmo.py", line 182, in <module> iterateStations(token_info['access_token']) File "netatmo.py", line 125, in iterateStations fetchMeasurements(access_token, station['_id'], substation['_id'], measurement_type, station['station_name'], name, client, substation['last_seen']) File "netatmo.py", line 144, in fetchMeasurements raise Exception(measurements) Exception: {'error': {'message': 'Filter wind does not exists', 'code': 21}}

Before this last update everything was working?
Is there something changed in the firmware so that the script will not work?

André

@ghoeffner
Copy link

ghoeffner commented Sep 10, 2018

Seems like this is a breaking API change? The issue still persists.

Fixed this by adding "Wind" to the allowed types and adding the following code on line 65:
if measurement_type.lower() in ['wind']: measurement_type = "WindStrength,WindAngle,Guststrength,GustAngle"

@AndreTzerra
Copy link
Author

Ghoeffner,

If I try to put it in line 65, I only get errors.
Can you specify where to put the code you added?
Bewteen witch lines?

@taarhaug
Copy link

taarhaug commented Jun 6, 2019

Here is the fix implemented after adding 'Wind' to the _ALLOWED_TYPES:

def iterateStations(access_token):
client = getInfluxDBClient()
station_info = getStationInfo(access_token)
if 'body' not in station_info:
raise Exception(station_info)
stations = station_info['body']['devices']

for station in stations:
    printStation(station)
    for measurement_type in station['data_type']:
        fetchMeasurements(access_token, station['_id'], "", measurement_type, station['station_name'], station['module_name'], client, station['last_status_store'])

    print('Modules:')
    for substation in station['modules']:
        printStation(substation)
        if substation['data_type'] == ['Wind']: 
            substation['data_type'] = ['WindStrength','WindAngle','GustStrength', 'GustAngle']

        for measurement_type in substation['data_type']:
            if 'module_name' in substation:
                name = substation['module_name']
            else:
                name = substation['_id']
            fetchMeasurements(access_token, station['_id'], substation['_id'], measurement_type, station['station_name'], name, client, substation['last_seen'])

Works great, thank you.

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

No branches or pull requests

3 participants