Skip to content

rbrenton/hasspanel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hasspanel

Generate configuration files for OpenHASP (JSONL) and Home Assistant (YAML) from a single PHP configuration file.

Designed for use with the SenseCAP Indicator D1 (480x480px display) running openHASP firmware.

Requirements

  • PHP 7.4 or higher (CLI)
  • OpenHASP device with firmware installed
  • Home Assistant with OpenHASP integration

Installation

git clone https://github.com/yourusername/hasspanel.git
cd hasspanel

Usage

1. Configure your panel

Copy the example configuration and customize it:

cp config.example.php config.php

Edit config.php to define your device and entities:

<?php
require_once('icons.php');
require_once('util.php');

// Panel identification
$device = array(
  'node' => 'your_panel_name',    // OpenHASP device name
  'banner' => 'Your Home Panel',  // Header text displayed on panel
);

// Define switches (toggleable entities)
map_to_rows([
  'icon' => '%0%',
  'label' => '%1%',
  'type' => 'switch',
  'default' => '0',
  'on_value' => 'On',
  'off_value' => 'Off',
  'entity' => '%2%',
], array(
  [ 'lightbulb', 'Living Room', 'switch.living_room_light' ],
  [ 'ceiling-light', 'Kitchen', 'light.kitchen' ],
));

// Define sensors (read-only text display)
map_to_rows([
  'icon' => '%0%',
  'label' => '%1%',
  'type' => 'text',
  'default' => 'n/a',
  'entity' => '%2%',
], array(
  [ 'thermometer', 'Temperature', 'sensor.indoor_temperature' ],
  [ 'water-percent', 'Humidity', 'sensor.indoor_humidity' ],
));

2. Generate configuration files

Generate the OpenHASP JSONL file (upload to your device):

php genhasp.php > pages.jsonl

Generate the Home Assistant YAML (add to your HA configuration):

php genhass.php > openhasp.yaml

3. Deploy

  1. Upload pages.jsonl to your OpenHASP device via its web interface
  2. Add the contents of openhasp.yaml to your Home Assistant configuration
  3. Restart Home Assistant

Available Icons

See icons.php for a full list of available icons. Common icons include:

Icon Name Use Case
lightbulb General lights
ceiling-light Ceiling fixtures
outdoor-lamp Outdoor lighting
thermometer Temperature sensors
door-closed Door sensors
garage-variant Garage doors
fan Fan controls
power-plug Smart plugs

Entity Types

Switch

Interactive toggle for switch.* and light.* entities:

'type' => 'switch'

Text

Read-only display for sensors:

'type' => 'text',
'format' => '%s°F',  // Optional format string

File Structure

hasspanel/
├── config.php          # Your panel configuration
├── config.example.php  # Example configuration
├── common.php          # Layout engine and object generation
├── genhasp.php         # OpenHASP JSONL generator
├── genhass.php         # Home Assistant YAML generator
├── icons.php           # Icon name to Unicode mapping
├── util.php            # Utility functions
└── README.md

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages