FLiP-Py-Pi-EnviroPlus - Using Apache Pulsar with Apache Spark, Apache Flink for processing sensor data
FLiP-Py-Pi-EnviroPlus FLiP-Py-Pi-EnviroPlus. Apache Flink, Apache Pulsar, Apache Spark, Python, Raspberry Pi, Enviro+ sensors. Tim streamnative Code ( https://github.com/tspannhw/FLiP-Py-Pi-EnviroPlus ) client = pulsar.Client('pulsar://pulsar1:6650') producer = client.create_producer(topic='persistent://public/default/rp4enviroplus' ,schema=JsonSchema(enviroplus),properties={"producer-name": "enviroplus-py-sensor","producer-id": "enviroplus-sensor" }) enviroRec = enviroplus() enviroRec.adjtemp = str(adjtemp) fa=open("/opt/demo/logs/envprec.log", "a+") fa.write(str(enviroRec) + "\n") fa.close() print(enviroRec) producer.send(enviroRec,partition_key=str(uniqueid)) Json Schema class enviroplus(Record): adjtemp = String() adjtempf = String() amplitude100 = Float() amplitude1000 = Float() amplitude500 = Float() amps = Float() cpu = Float() cputemp = String() cputem