Publishing custom input from emonpi to emoncms.org

If you are posting direct to emonCMS on the emonPi then no, emonCMS cannot forward that data as emonCMS has no ability to forward data to other targets. Only emonHub can do that and if you are posting direct to emonCMS using a HTTP API request or by publishing MQTT then you are bypassing emonHub.

Can you confirm how exactly the data is passed for the RPi to the emonPi?

Assuming for the moment you are using HTTP API’s you can indeed change your script to post to both emonCMS targets (on the emonPi and emoncms.org). This is possibly the “easy” option but IMO it is not the best option, as you have already mentioned, you could lose data due to network outages etc.

If you were to post to emonHub on the emonPi instead of to emonCMS, emonHub could then post to as many emonCMS instances as you like, what emonHub adds to the mix is the fact it can buffer the data, so that when posting to emoncms.org and the internet goes down (for example) emonHub can buffer the data from your script and post it to emoncms.org later, after the network comes up again.

To post to emonhub from your RPi you would need to use an emonHub socket interfacer, there are several forum discussions explaining how to use socket interfacers, they are real easy to use, just not well documented and it would mean altering your script to post a different way, but you would need to do that to make it post to 2 locations anyway.