Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

OpenHAB command script for PixelIt

License

NotificationsYou must be signed in to change notification settings

miccgn/openhab-pixelit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This script handles communication betweenOpenHAB and the PixelIt device (seeo0shojo0o/PixelIt andhttps://www.bastelbunker.de/pixel-it/).

It allows both sending messages to PixelIt for immediate display and also managing a playlist with screen definitions, thus making OpenHAB become a PixelIt controller.

How it works

How does PixelIt work?

In order to display content on your PixelIt device, you have to send ascreen definition. Ascreen definition is a piece of JSON code describing what to display next:

{"switchAnimation":{"aktiv":true,"animation":"fade"   },"bitmap":{"data":[0,32799,63519,43029,43029,43029,0,0,0,32799,63519,0,0,0,63504,0,0,32799,63519,0,0,0,63504,0,0,32799,63519,0,0,0,63504,0,0,32799,63519,43029,43029,43029,0,0,0,32799,63519,0,0,0,0,0,0,32799,63519,0,0,0,0,0,0,32799,63519,0,0,0,0,0],"position":{"x":0,"y":0      },"size":{"width":8,"height":8      }   },"text":{"textString":"10","bigFont":false,"centerText":true,"hexColor":"#FFFFFF"   }}

This tells PixelIt to...

  • ... fade the current screen out and the new screen in
  • ... show a bitmap described by thedata section (actually, that's the PixelIt logo)
  • ... show the text"10" next to it, centered, in white color

There are more commands to use. See the fullAPI specification.

How does this controller script work?

Basically, the "controller" helps you to manage screen definitions like described before. It stores them in a single playlist and plays them out to your PixelIt one after another.

The "controller" consists of

  • an OpenHAB String item receiving commands
  • a script being triggered by comamnds sent to this item, manipulating playlist items.

Installation

1) Item

Create a String Item which will receive your commands. Choose any name that fits your naming convention for this item:

StringPixelItCommand"Commands for PixelIt controller"

(Of course you can also use the Main GUI to create the String Item.)

2) Rule

Create a rule to handle commands that are posted to the item.

  1. Create a new rule. Pick any name and description you like.
  2. From the first screen, select theCode tab and paste the content of the YAML-file from this repository.
  3. Make sure to insert the name you chose for the item and the proper IP address of your PixelIt at the places indicated:image

That's it! Now start sending commands to your PixelIt controller:

PixelItCommand.sendCommand("message Hello World!")

Usage

Creating screens

The following commands are supported:

add SCREENNAME SCREENDEFupdate SCREENNAME SCREENDEF

whereSCREENNAME is any name you want to give that screen for managing it in your playlist, andSCREENDEF is a screen definition like describedabove.add andupdate are completely interchangeable: if the screen namedSCREENNAME already exists, it will be updated, otherwise it will be created.

Example:

add welcome {"switchAnimation":{"aktiv":true,"animation":"fade"},"bitmap":{"data":[0,32799,63519,43029,43029,43029,0,0,0,32799,63519,0,0,0,63504,0,0,32799,63519,0,0,0,63504,0,0,32799,63519,0,0,0,63504,0,0,32799,63519,43029,43029,43029,0,0,0,32799,63519,0,0,0,0,0,0,32799,63519,0,0,0,0,0,0,32799,63519,0,0,0,0,0],"position":{"x":0,"y":0},"size":{"width":8,"height":8}},"text":{"textString":"Welcome!","bigFont":false,"centerText":true,"hexColor":"#FFFFFF"}}

As soon as the first screen has been added, a timer will play the playlist.

Defining for how long to display each screen

By default, each screen will be displayed for 7 seconds before going on with the next item in the playlist. You can define this team per screen with an additional item in your screen definiton:

... "displayTime": SECONDS, ...

Example:

add welcome {"displayTime": 10, "switchAnimation":{"aktiv":true,"animation":"fade"},"bitmap":{"data":[0,32799,63519,43029,43029,43029,0,0,0,32799,63519,0,0,0,63504,0,0,32799,63519,0,0,0,63504,0,0,32799,63519,0,0,0,63504,0,0,32799,63519,43029,43029,43029,0,0,0,32799,63519,0,0,0,0,0,0,32799,63519,0,0,0,0,0,0,32799,63519,0,0,0,0,0],"position":{"x":0,"y":0},"size":{"width":8,"height":8}},"text":{"textString":"Welcome!","bigFont":false,"centerText":true,"hexColor":"#FFFFFF"}}

This will display the screen namedwelcome for 10 seconds before advancing to the next one.

Removing screens

delete SCREENNAME

Removes the screen defined with the nameSCREENNAME from your playlist.

Interrupting with urgent messages

message SCREENDEF

Shows the screen defined bySCREENDEF, then goes on with the next regular screen in your playlist. This is intended to be used for one-time messages from your rules.

error TEXTwarning TEXT

These two commands go without a full screen definition. Instead, they just take any text as parameter, wrap it with a default screen definition and use the technique for themessage command to display it.

About

OpenHAB command script for PixelIt

Topics

Resources

License

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp