Black Lives Matter. Please consider donating to Black Girls Code today.

Plotly streaming

I have had a raspberry pi at a remote location publishing temperature data to a graph using API and tokens. I have logged in lately at it has stopped working. I investigated the Pi and found it could not log into plotly. It seems there has been a revision to 4 and online streaming is no longer supported. Rather than post the whole program up here is an example i found online i used as the basics of my project. I have tried to implement the new changes to plotly to use chart_studio. Which seems to be the direction i need to go to get this working again. But i am just getting into a muddle. Do i need Dash? Do I need chart_studio?

import sys
import time
import datetime
#import chart_studio.plotly as py
#import plotly.plotly as py # plotly library
from chart_studio.plotly import plot, iplot
#from chart_studio.plotly import Scatter, Layout, Figure, Data, Stream, YAxis

Plot.ly credentials and stream tokens

username = ‘andtit’
api_key = ‘F9K3U********yMd1fHw’
stream_token_temperature = ‘b8l2re’
stream_token_humidity = '1jcy
m3’

py.sign_in(username, api_key)

trace_temperature = Scatter(
x=,
y=,
stream=Stream(
token=stream_token_temperature
),
yaxis=‘y’
)

trace_humidity = Scatter(
x=,
y=,
stream=Stream(
token=stream_token_humidity
),
yaxis=‘y2’
)

layout = Layout(
title=‘Raspberry Pi - Temperature and humidity’,
yaxis=YAxis(
title=‘Celcius’
),
yaxis2=YAxis(
title=’%’,
side=‘right’,
overlaying=“y”
)
)

data = Data([trace_temperature, trace_humidity])
fig = Figure(data=data, layout=layout)

#print py.plot(fig, filename=‘Raspberry Pi - Temperature and humidity’)

stream_temperature = py.Stream(stream_token_temperature)
stream_temperature.open()

stream_humidity = py.Stream(stream_token_humidity)
stream_humidity.open()

while(True):

Run the DHT program to get the humidity and temperature readings!

output = subprocess.check_output(["./Adafruit_DHT", “2302”, “17”]);
#print output

search for temperature printout

matches = re.search(“Temp =\s+([0-9.]+)”, output)
if (not matches):
time.sleep(3)
continue
temp = float(matches.group(1))

search for humidity printout

matches = re.search(“Hum =\s+([0-9.]+)”, output)
if (not matches):
time.sleep(3)
continue
humidity = float(matches.group(1))

print (“Temperature: %.1f C” % temp)
print (“Humidity: %.1f %%” % humidity)

Append the data to the streams, including a timestamp

now = datetime.datetime.now()
stream_temperature.write({‘x’: now, ‘y’: temp })
stream_humidity.write({‘x’: now, ‘y’: humidity })

Wait 30 seconds before continuing

time.sleep(30)

stream_temperature.close()
stream_humidity.close()

Hi there! Unfortunately, streaming is no longer supported in Chart Studio Cloud as of February of this year. Sorry for the inconvenience…

OK thank you for prompt reply. Streaming data on plotly was a very useful for my project, as with plotly i could graph 16 temperatures on a single graph. I could then monitor the graph remotely and diagnose any issues with the system. I have used Thingspeak for other projects. But Thingspeak sets up a graph for each temperature. Do you know of any other platform i can use now that plotly no longer supports my needs. I have used plotly for over 2 years for free. So sorry to see good things come to end. Can i stream to a local graph on the raspberry pi. and then i could log in via VNC to mirror the log on my home computer?

Oh no, that was the best feature available. I was using it for years!
Very, very sad.

Then why it is still available in your interface? User has no chance to know about the support was closed.

Yes very confusing. I spent quite a while trying to fix the steaming plotly. And there is some details on the site regarding using and importing STUDIO into python to get it working again. So wasted even more time to find out this is not the case either. I am sure there is a valid reason for the developers to end streaming of plotly. Perhaps the cost of hosting the data on their servers? But as yet i can’t find an alternative.

Is Streaming Plotly gone forever? If So, I have no further use for Plotly and will unsubscribe.

That is correct: we currently have no plans to reactivate streaming features on Chart Studio Cloud.