Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
1-wire to mqtt Camel route
<route>
<!-- Read temperatures from the owfs directory structure. -->
<from uri="file:/Users/mark/work/test?noop=true&amp;readLock=none&amp;idempotent=false&amp;delay=10000&amp;antInclude=*/temperature&amp;recursive=true" />
<!-- Get temp and add date/time -->
<transform>
<simple>${bodyAs(String)} at ${date:now:yyyy-MM-dd hh:mm:ss}</simple>
</transform>
<log message="Got ${body} from ${file:parent}" />
<!-- Send to topic temperatures/[position] where position taken from the file path -->
<recipientList ignoreInvalidEndpoints="true" >
<javaScript>
'mqtt:test?publishTopicName=temperatures.' + request.getHeaders().get('CamelFileName').split('/')[0];
</javaScript>
</recipientList>
</route>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.