spark: Support JSON event data.

Attempt to treat Spark Core Event data as JSON. If that doesn't work,
fall back to treating them as simple strings.
spark-api: Increase device refresh attempts.

We now refresh devices every time we have to reconnect the events
connection, as well as about once a day on a timer.

This are both intended to make sure that we recover from transient
connection errors in time.