However, I cannot get it to work with Cosm. Has anyone made any progress on that? Any other code I found just does not work.
The reason why the sketch won't work with cosm is that it was never intended to work with cosm. There is plenty of code around that does work. The most likely place to find it is in the "It Works!" section of the cosm forum. You will even find one of mine you can use or adapt.
I suspect you don't know what cosm is about. It is an internet data service that you feed to, but that data can be made available to the public. The vital thing is that it uses two keys - a feed id that the public can use, and yourself, and an API key that is exclusive to you, covers all your feeds, and is used for maintenance etc. Any cosm sketch will contain both these keys.
The first thing you need to do is register with cosm and thereby obtain the keys.
Note that a "feed" may include several sensors. It is not necessary to include date and time in a feed.
Note also that there a couple of new libraries, cosm and httpClient, that make life a lot easier.https://cosm.com/feeds/83153