Here is code that we posted on the Neptune Forum. This code will provide you with the basics of what you need and you can then tweak it to your liking and needs.
https://forum.neptunesystems.com/showthread.php?12301-Gyre-XF130-dual-Icecap-interface-module-setup-help-please-review-my-code&p=82875&viewfull=1#post82875