SMART HOME CMS v2 - READY FOR CPANEL

REQUIREMENTS
- PHP 8.1+ (8.2 recommended)
- PDO MySQL
- PHP cURL
- MySQL/MariaDB
- HTTPS

QUICK SETUP

1. Create MySQL database + user in cPanel.
2. Import installer.sql using phpMyAdmin.
3. Upload this folder as:
   public_html/smart-home/
4. Edit:
   smart-home/inc/config.php
   Fill DB_HOST, DB_NAME, DB_USER, DB_PASS, HA_URL, HA_TOKEN.
5. Make sure HTTPS works for your domain.
6. Open:
   https://YOUR-DOMAIN/smart-home/create-admin.php
7. Create first Super Admin.
8. IMPORTANT: delete create-admin.php after admin is created.
9. Login:
   https://YOUR-DOMAIN/smart-home/login.php
10. CMS:
   https://YOUR-DOMAIN/smart-home/cms/

INITIAL CMS WORKFLOW
A. CMS > HA Discovery > Run Discovery Now.
B. CMS > Channels > create channel/property.
C. Open channel > add rooms (optional).
D. Open Publish Components > tick components > Publish.
E. CMS > Users > create user.
F. Assign channel to user and set Default + Can control.
G. Login as user and open dashboard.

WEB / APP
Web URL:
  https://YOUR-DOMAIN/smart-home/

WebView APK URL:
  https://YOUR-DOMAIN/smart-home/app/

The WebView app does NOT need a channel parameter.
Channel is determined by logged-in user's session.
If user has multiple channels, switcher appears automatically.

REAL-TIME CONFIG CHANGE
- Each channel has config_version.
- CMS component changes increase config_version.
- Browser/App polls version every 2 seconds.
- If changed, config is reloaded without APK rebuild.
- HA states are also refreshed every 2 seconds.

SECURITY NOTES
- HA token remains server-side only.
- Use a new HA token and never expose it in JS/APK.
- Replace Quick Tunnel with a stable Cloudflare Named Tunnel before production.
- HTTPS required.
- Do not leave create-admin.php on the server.
- If APP_BASE_PATH is different from /smart-home, update it in inc/config.php.

CURRENT COMPONENT ACTION SUPPORT
- input_boolean / switch / light: toggle
- input_number: +/- set_value
- script / scene: run
- cover: open / close
- lock: lock / unlock
- sensor / binary_sensor: display
- climate/media_player: currently display-only generic card
  (can be extended in CMS engine later)
