syncsign

package module
v1.2.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 20 Imported by: 1

README

Go Reference GitHub go.mod Go version GitHub release (latest by date) Go Report Card Actions Status

HomeDashboard Renderer for SyncSign® eInk Displays

Renders listen to a data source and generates content for SyncSign® eInk displays.

Renderers

All renderers implement the Renderer interface to provide generic way for content generation.

Response Renderer

Response renderers generates response payload used in SyncSign template servers, in JSON format. It's template used default structure required for SyncSign displays and provides a posibility for other renderers to add items.

Config

Defines path to template file.

hdb:
  response:
    template: "response.json"

Item Renderers

Item renderes generates items which will be picked up by response renderer to gnereate a complete response for displays. This can be simple text, geometric shapes or icons.

Timestamp

A timestamp renderer generate a single item with current timestamp. By default it's position is in the lower left corner. Uee NewTimestampRenderer to generate such a renderer.

Config

Defines path to template file.

hdb:
  response:
    template: "response.json"
Billing Report

Billing report renderer subsribes to a datasource which provides BillingReport and Exchange Rate events to visialize cost for AWS usage.

Config

Defines path to template file, set anchor and used currencies.

hdb:
   billingreport:
    template: billingreport.json
    anchor:
      "x": 720
      "y": 10
    report_currency: USD
    display_currency: EUR
Template

Config option to set template file which should be used generate billing report items.

Anchor

An anchor defines the upper left corner of billing report elements.

report_currency

Currency used in BillingReport events.

display_currency

Currency billing report amount shpuld be displayed in. If display_currency differs from report_currency, the exchange rate datasource have to provide such an exchange rate. If there's no suitable exchange rate, billing report amount will be rendered in report_currency.

Error

In case something went wrong during content genration, error renderer can be used to generate a suitable server response for an error. Use NewErrorRenderer for initialization.

Config

Defines path to template file.

hdb:
  error
    template: "error.json"
Indoor Climate

This renderer listen to a data source for indoo climate, which includes temperature, humidity and, depending on used sensor, battery status. Indoor climate data can be processed for diferent devices and can be assigned by config to seperate rooms. Same template is used for each room and all rooms will be displayed in a row until scrren width exceeds. Initialized by NewIndoorClimateRenderer.

Config

Following example config contains all available config options for indoor climate renderer.

hdb:
  indoorclimate:
    template: "indoorclimate.json"
    anchor: 
      x: 10
      y: 10
    size:
      height: 200
      width: 200
    border: 5
    rooms:
      - id: "1"
        name: "Room1"
        displayIndex: "0"
      - id: "2"
        name: "Room2"
        displayIndex: "1"
    devices:
      - id: "Device2"
        roomId: "1"
      - id: "Device1"
        roomId: "2"
Template

Config option to set template file which should be used to generate a single room element. This file will be reused for all rooms.

Anchor

An anchor defines the upper left corner of element for first room.

Size

Defines the entire size of a romm element which includes temperature, humidity and battery status icon.

Border

Defines a space in pixel between each room element. Border can be set in general for top, right, bottom and left or for each attribute separately.

Rooms

List of room which should be displayed as single element on screen, DisplayIndex defines the order of rooms on the screen from left to right. Name will be displayed on screen and id is used to assign devices.

Devices

Each room needs at least one assigned device to be displayed on screen.

General Config

Tempalte Directory

Use following config to set directory of templates for all renderers. Default value is folder "templates" at runtime location.

hdb:
  template_dir: "templates"

Supported Display

Only 7.5 inch display is supported for HomeDashboard project.

Documentation

Index

Constants

View Source
const (
	COLOR_WHITE textColor = "WHITE"
	COLOR_BLACK textColor = "BLACK"
	COLOR_RED   textColor = "RED"
)
View Source
const (
	BATTERY_LEVEL_4_4 batteryLevelIcon = "\uf240"
	BATTERY_LEVEL_3_4 batteryLevelIcon = "\uf241"
	BATTERY_LEVEL_2_4 batteryLevelIcon = "\uf242"
	BATTERY_LEVEL_1_4 batteryLevelIcon = "\uf243"
	BATTERY_LEVEL_0_4 batteryLevelIcon = "\uf244"
)

Variables

This section is empty.

Functions

func NewErrorRenderer

func NewErrorRenderer(template core.Template, err error) core.Renderer

NewErrorRenderertemplate returns a renderer which generates items for passed error message.

func NewResponseRenderer

func NewResponseRenderer(template core.Template, nodeId string, itemRenderer []core.Renderer) core.Renderer

NewResponseRenderer returns a new renderer for eInk main content. Passed data have to contain all items which shloud be displayed.

func NewTimestampRenderer added in v1.1.0

func NewTimestampRenderer(template core.Template) core.Renderer

NewTimestampRenderer returns a new renderer to generate a single item which contains a timestamp.

Types

type BillingReportRenderer added in v1.2.0

type BillingReportRenderer struct {
	// contains filtered or unexported fields
}

func NewBillingReportRenderer added in v1.2.0

func NewBillingReportRenderer(conf config.Config, logger log.Logger, template core.Template, datasource core.DataSource) *BillingReportRenderer

NewBillingReportRenderer returns a renderer which generates items for AWS billing reports.

func (*BillingReportRenderer) Content added in v1.2.0

func (renderer *BillingReportRenderer) Content() (string, error)

Content generates items for billing reports received from used datasource.

func (*BillingReportRenderer) ObserveDataSource added in v1.2.0

func (renderer *BillingReportRenderer) ObserveDataSource(ctx context.Context)

ObserveDataSource will listen for new billing reports and exchange rate events, if report and display currency differs.

type DisplayConfig

type DisplayConfig struct {
	// contains filtered or unexported fields
}

func NewDisplayConfig

func NewDisplayConfig(conf config.Config) *DisplayConfig

NewDisplayConfig extracts list of display ids from passed config and returns a DisplayCondig which can be used to ensure valid display ids.

func (*DisplayConfig) All

func (cfg *DisplayConfig) All() []string

All returns the list of all available display ids.

func (*DisplayConfig) Exists

func (cfg *DisplayConfig) Exists(displayId string) bool

Exists returns true if passed display id is available in internal display list.

type ErrorRenderer

type ErrorRenderer struct {
	// contains filtered or unexported fields
}

func (*ErrorRenderer) Content

func (renderer *ErrorRenderer) Content() (string, error)

Content returns errpr message passed at initialization as items. Together with a title and a timestamp.

type IndoorClimateRenderer added in v1.1.0

type IndoorClimateRenderer struct {
	// contains filtered or unexported fields
}

func NewIndoorClimateRenderer

func NewIndoorClimateRenderer(conf config.Config, logger log.Logger, template core.Template, datasource core.DataSource) *IndoorClimateRenderer

NewIndoorClimateRenderer returns a new renderer for infoor climate data. Room will be taken from passed config, template and datasource have to be passed.

func (*IndoorClimateRenderer) Content added in v1.1.0

func (renderer *IndoorClimateRenderer) Content() (string, error)

Content fetches current inddor climate data and generated room climate elements based pn given room/device config.

func (*IndoorClimateRenderer) ObserveDataSource added in v1.1.0

func (renderer *IndoorClimateRenderer) ObserveDataSource(ctx context.Context)

ObserveDataSource will listen for new indoor climate data provided by used datasource.

type ResponseRenderer

type ResponseRenderer struct {
	// contains filtered or unexported fields
}

func (*ResponseRenderer) Content

func (renderer *ResponseRenderer) Content() (string, error)

Content returns the main layout for eInk display which includes renderer/node id and all passed items.

type TimestampRenderer added in v1.1.0

type TimestampRenderer struct {
	// contains filtered or unexported fields
}

func (*TimestampRenderer) Content added in v1.1.0

func (renderer *TimestampRenderer) Content() (string, error)

Content generates a single item with a current timestamp.

type WeatherIconMap added in v1.2.5

type WeatherIconMap struct {
	// contains filtered or unexported fields
}

type WeatherRenderer added in v1.2.5

type WeatherRenderer struct {
	// contains filtered or unexported fields
}

func NewWeatherRenderer added in v1.2.9

func NewWeatherRenderer(conf config.Config, logger log.Logger, currentWeatherTemplate core.Template, forecastTemplate core.Template, datasource core.DataSource) *WeatherRenderer

NewWeatherRenderer returns a renderer which generates items for current weather and forcast.

func (*WeatherRenderer) Content added in v1.2.9

func (renderer *WeatherRenderer) Content() (string, error)

Content generates items for weather data.

func (*WeatherRenderer) ObserveDataSource added in v1.2.9

func (renderer *WeatherRenderer) ObserveDataSource(ctx context.Context)

ObserveDataSource will listen for new billing reports and exchange rate events, if report and display currency differs.

Directories

Path Synopsis
k8s module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL