You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 7, 2018. It is now read-only.
The Dashing by default just displays the data just received. If you would like to store the data received and then send it to your widget, you may use Redis datastore.
The job should be modified to store and read the data, see below the example how to do it with simple Number widget:
require 'redis' # https://github.com/redis/redis-rb
redis_uri = URI.parse(ENV["REDISTOGO_URL"])
redis = Redis.new(:host => redis_uri.host, :port => redis_uri.port, :password => redis_uri.password)
SCHEDULER.every '20s', :first_in => 0 do |job|
rand_value = rand(1000) # replace this line with the code to get your data
prev_value = redis.get("widget-id-prev-value") # read previous value from the Redis datastore
redis.set("widget-id-prev-value", rand_value) # store current value to the Redis datastore
send_event('karma', { current: rand_value, last: prev_value })
end