Code Monkey home page Code Monkey logo

Comments (8)

avaldebe avatar avaldebe commented on June 23, 2024

what is the port of your local MQTT server? The CLI uses port 1883 by default.

from pypms.

taarhaug avatar taarhaug commented on June 23, 2024

from pypms.

avaldebe avatar avaldebe commented on June 23, 2024

I do not know, what is the version of the Python MQTT library? (pip show paho-mqtt)
Is that version compatible with your MQTT server?

from pypms.

taarhaug avatar taarhaug commented on June 23, 2024

1.6.1. I use this client for a MQTT generator that works nicely with mosquitto. I reproduced the error on a RPi running raspbian.

from pypms.

avaldebe avatar avaldebe commented on June 23, 2024

I have no idea what the problem could be. I just released a new version of the library and CLI, but I do not think that updating would help. BTW, what version of python and PyPMS are you using?

from pypms.

taarhaug avatar taarhaug commented on June 23, 2024

pypms 0.6.2, python 3.6.9 on ubuntu 18.04
pypms 0.6.2, python 3.7.3 on raspbian

from pypms.

taarhaug avatar taarhaug commented on June 23, 2024

Oddest thing, Topic is critical here:

I collect data and publish:
pms -m SPS30 -n 1 -i 10 -s /dev/ttyUSB1 mqtt --mqtt-host localhost --mqtt-port 1883 -t "home/dust/SPS30"

I try to collect with mosquitto:
mosquitto_sub -t "home/dust/SPS30"

This collects nothing, but this does:

mosquitto_sub -t "home/#" (or even "home/dust/#, "home/+/#")

Not sure why. I can't see Topic sent but I check that mosquitto[_sub,_pub] works as expected with Topic publish and subscribe.

Sent data looks like this:

true
PM1
sensor,unit,concentration
SPS30
μg/m3
1.107303261756897
PM2.5
sensor,unit,concentration
SPS30
μg/m3
1.7731504440307617
PM4
sensor,unit,concentration
SPS30
μg/m3
2.2605395317077637
PM10
sensor,unit,concentration
SPS30
μg/m3
2.3580174446105957
1.2040939331054688
1.5197216272354126
1.7191693782806396
1.759059190750122
false

I guess the numbers at the end are number concentrations and typical particle size. But which is which?

SDS198 seem to get a double concentration entry in the data:

true
PM100
sensor,unit,concentration
SDS198
μg/m3
7
7
false

from pypms.

taarhaug avatar taarhaug commented on June 23, 2024

I found the issue. The way data is sent to mqtt, you cannot expect to publish and subscribe to the same topic (like you would find in most examples). I found it by verbose subscription:

$ mosquitto_sub -v -t "#"
home/dust/SDS198/$online false
home/dust/SDS198/pm100/$type PM100
home/dust/SDS198/pm100/$properties sensor,unit,concentration
home/dust/SDS198/pm100/sensor SDS198
home/dust/SDS198/pm100/unit μg/m3
home/dust/SDS198/pm100/concentration 2
home/dust/SDS198/$online true

My apologies, I've should have read up more on MQTT before I started testing.

from pypms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.