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

Only create one instance of sensor_module for ADS1x15 #286

Merged
merged 2 commits into from
Oct 13, 2022

Conversation

shbatm
Copy link
Contributor

@shbatm shbatm commented Oct 11, 2022

Instead of requiring a separate sensor_module config section for each pin on an ADS1x15, this requires you to set the pins to use in a single module, and assigning the specific sensor pins in the sensor_inputs section--allowing the re-use of the Sensor class instance and preventing the issues seen in #254.

The ads1x15 sensor class has been updated to create an analog channel for each pin assigned in the config, up to all 4 available channels.

New config example:

sensor_modules:
  - name: ads_0
    module: ads1x15
    type: ADS1115
    pins:
      - 0
      - 1

sensor_inputs:
  - name: voltage_channel_0
    module: ads_0
    type: voltage
    pin: 0
    interval: 2

  - name: voltage_channel_1
    module: ads_0
    type: voltage
    pin: 1
    interval: 2

Fixes #254.

@jcsouthworth
Copy link

Thank you for posting this request - would fix the issue I am having. Hoping this gets merged somewhat soon!

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

Successfully merging this pull request may close these issues.

Problem with ads1x15 - readings messed up
3 participants