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

Dallas sensor ID #377

Closed
xoseperez opened this issue Jan 8, 2018 · 6 comments
Closed

Dallas sensor ID #377

xoseperez opened this issue Jan 8, 2018 · 6 comments
Labels
enhancement New feature or request minor sensors

Comments

@xoseperez
Copy link
Owner

Originally reported by: Albert Weterings (Bitbucket: AlbertWeterings, GitHub: Unknown)


I'm trying to get the ID of my Dallas sensors into a MQTT message together with the temperature. Is this already possible or can you point me to where in the code I can make changes to get this?

in a different application I log sensor values to a DB together with the sensor ID and time currently when I connect multiple Dallas sensors I can't identify the sensor. I would like to change this application to ESPurna there for the sensor ID is needed..

@xoseperez
Copy link
Owner Author

I see two options. The first one is to add the address to the topic and then parse the topic in your application, something like:

ESPURNA_343624/temperature/28FF732970160440 => 17.0

The second option is to publish the address for each "channel". You will then receive at least two messages like this:

ESPURNA_343624/temperature/0 => 17.0
ESPURNA_343624/temperature/0/address => 28FF732970160440

Then you can enable the JSON grouping in the MQTT tab to get all messages in the same payload (along with more info like timestamp, ip,...), something like:

ESPURNA_343624\data => {'temperature/0': 17.0, 'temperature/0/address': '28FF732970160440', ...}

This second option is less "invasive" so it's something I could add to the default build...

@xoseperez
Copy link
Owner Author

You can give a try to the second option in the dev branch, edit the sensor.h file to enable SENSOR_PUBLISH_ADDRESSES setting.

@xoseperez
Copy link
Owner Author

Original comment by Albert Weterings (Bitbucket: AlbertWeterings, GitHub: Unknown):


I tested the changes as I found in [Link Text]170f0d5(Link URL)]https://bitbucket.org/xoseperez/espurna/commits/170f0d543c767e8e9a95223a36d3e6cef52bb295

For Dallas sensors I can confirm it works great. There is one downside in Node-red it is hard to handle with the identifier msg.payload.temperature/0 as it doesn't accept the slash so I first had to replace all slashes with other characters to get it working

Thank you for the effort putting into this issue

@xoseperez
Copy link
Owner Author

Good. I will release it with next version.

About your issue with Node-RED. You can use msg.payload['temperature/0']. Is not so clean but it works.

@xoseperez
Copy link
Owner Author

Released with 1.11.4

@xoseperez
Copy link
Owner Author

Removing milestone: 1.11.4 (automated comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor sensors
Projects
None yet
Development

No branches or pull requests

1 participant