tenderlove/pixoo-rb: Pixoo client for Ruby

This is just a client for Pixoo 64 Sign written in Ruby.

Create something and then display it as an animated image:

include Pixoo::Utils

images = [7, 17, 29].map 
      if ((x 

dev = Pixoo::Client.find_all.first
dev.send_animation images
sleep 1

# add some text
dev.send_text "Hello", x: 0, y: 0, id: 1
dev.send_text "World", x: 0, y: 40, id: 2, font: 6

Read a PNG and display it:

img = Pixoo::ImageBuffer.from_png ARGV[0]

dev = Pixoo::Client.find_all.first
dev.send_animation [img]

Reading from a remote server

This thing supports reading values ​​from a remote server. I have a server that collects PM2.5/CO2 sensors located in the house. On the server, I have a Webrick server that responds to requests for sensor information. For example, to get PM2.5 data from my office, I can do this:

$ curl 'http://tender.home:9292/reading?floor=main&room=office&measurement=pm2.5'
{"DispData":"25"}

The response is important because this display will parse the response and display it on the sign. I have configured the sign as follows:

dev = Pixoo::Client.find_all.first

label = dev.new_display_item(id: 1,
  type: Pixoo::DisplayItem::TEXT_MESSAGE,
  x: 0,
  y: 0,
  dir: 0,
  font: 18,
  width: 64,
  height: 5,
  string: "PM2-5:",
  speed: 10,
  color: "#FF0000",
  align: 1)

value = dev.new_display_item(id: 2,
  type: Pixoo::DisplayItem::NET_TEXT_MESSAGE,
  x: 23,
  y: 0,
  dir: 0,
  font: 18,
  width: 64,
  height: 5,
  string: "http://tender.home:9292/reading?floor=main&room=office&measurement=pm2.5",
  speed: 10,
  color: "#FFFFFF",
  align: 1)

Sign will automatically fetch data from my server and update the display.



<a href

Leave a Comment