Skip to content

Instantly share code, notes, and snippets.

@Tingenek
Created February 24, 2013 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tingenek/5025014 to your computer and use it in GitHub Desktop.
Save Tingenek/5025014 to your computer and use it in GitHub Desktop.
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