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

Bug? "device_name" in influxDB is the same for all devices. #108

Closed
ngolf opened this issue Aug 26, 2024 · 2 comments
Closed

Bug? "device_name" in influxDB is the same for all devices. #108

ngolf opened this issue Aug 26, 2024 · 2 comments

Comments

@ngolf
Copy link
Contributor

ngolf commented Aug 26, 2024

I am using the built in influxdb command, and a config file.

The "device" tag value in influxdb is the same for all devices, particularly, it adopts the name of the last device in my config file.

E.g config:

`{
"devices": [
{
"device": "FitnessEquipment",
"id": 9384,
"transmission_type": 5
},

    {
        "device": "PowerMeter",
        "id": 35015,
        "transmission_type": 101
    },
    {
        "device": "BikeSpeedCadence",
        "id": 9384,
        "transmission_type": 1
    },
    {
        "device": "HeartRate",
        "id": 50967,
        "transmission_type": 193
    },
    {
        "device": "PowerMeter",
        "id": 9384,
        "transmission_type": 5
    }
]

}`

Output (note the HR data stored as power_meter_09384. If I put the HR sensor last in the list, then the all sensors would get device = heart_rate_50967):

Device power_meter_09384 broadcast heart_rate data: HeartRateData(page_specific=3464960, beat_time=14.41796875, beat_count=21, heart_rate=51, operating_time=16777215, manufacturer_id_lsb=255, serial_number=65535, previous_heart_beat_time=13.2177734375, battery_percentage=255)
Writing: {'measurement': 'HeartRateData', 'tags': {'device': 'power_meter_09384', 'uuid': '4bd24577-9783-4e82-8cb9-4eaf7d699c12', 'host': 'pi5'}, 'time': 1724695493492374016, 'fields': {'page_specific': 3464960, 'beat_time': 14.41796875, 'beat_count': 21, 'heart_rate': 51, 'operating_time': 16777215, 'manufacturer_id_lsb': 255, 'serial_number': 65535, 'previous_heart_beat_time': 13.2177734375, 'battery_percentage': 255}}
Device power_meter_09384 broadcast standard_power data: PowerData(instantaneous_power=0, average_power=81, left_power=-1, right_power=-1, torque=3.44505033557047, angular_velocity=23.092251657330152, cadence=16)
Writing: {'measurement': 'PowerData', 'tags': {'device': 'power_meter_09384', 'uuid': '4bd24577-9783-4e82-8cb9-4eaf7d699c12', 'host': 'pi5'}, 'time': 1724695493926188032, 'fields': {'instantaneous_power': 0, 'average_power': 81, 'left_power': -1, 'right_power': -1, 'torque': 3.44505033557047, 'angular_velocity': 23.092251657330152, 'cadence': 16}}
@tuna-f1sh
Copy link
Collaborator

Yes it's a bug - the reference is passed to the closure so they all have the last one in the iteration. I've passed the value with the closure args, which should fix it. Please can you test https://github.com/Tigge/openant/compare/closure-bug

@ngolf
Copy link
Contributor Author

ngolf commented Aug 27, 2024

Tested, Issue seems fixed.

tuna-f1sh added a commit that referenced this issue Aug 28, 2024
* #108 ensure value not refence passed to closure

* added extra (debug) logging

* improved debug message on catch

* formatting

---------

Co-authored-by: John Whittington <git@jbrengineering.co.uk>
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

4 participants
@tuna-f1sh @ngolf and others