A custom Home Assistant integration that retrieves CEM account data, objects (places), meters, counters, and last readings.
This project is community‑maintained and not affiliated with CEM or Softlink.
- Login to the CEM API
- Fetch account information
- Discover objects (
mis_id) - Discover meters (
me_id, including serial numbers) - Discover counters (
var_id) per meter - Hierarchical counter selection during setup — choose which counters to expose
- Configurable update intervals — control how often counter readings are refreshed (default: 30 minutes, range: 1–1440 minutes)
- Expose eligible counters as sensors with:
- Meter ID (
me_id) - Counter ID (
var_id) - Meter serial (when available)
- Unit metadata from CEM (e.g.
m³,kWh, …)
- Meter ID (
- Automatic device structure for account and objects
- Debug service (
get_raw) for inspecting raw CEM API responses
- In Home Assistant, open HACS → Integrations → Custom repositories.
- Add this repository URL as a Custom repository (category: Integration).
- Search for CEM Monitoring Integration in HACS and install it.
- Restart Home Assistant.
-
Download the latest release from GitHub.
-
Copy the folder:
custom_components/cem_monitorinto your Home Assistant
config/custom_componentsdirectory. -
Restart Home Assistant.
- Go to Settings → Devices & Services → Add Integration.
- Search for CEM Monitoring Integration.
- Enter your CEM credentials (username and password).
- After authentication, you'll be presented with a hierarchical counter selection screen showing:
- Objects (places) with their
mis_id - Meters within each object with serial numbers and counter types
- Individual counters (
var_id) with their names
- Objects (places) with their
- Select the counters you want to expose as sensors (you can select multiple).
- Complete the setup.
Multiple CEM accounts are supported — each account is configured separately.
To change your counter selection or update interval after initial setup:
- Go to Settings → Devices & Services.
- Find your CEM Monitoring Integration entry.
- Click Configure (or the three-dot menu → Configure).
- You can:
- Select/deselect counters — modify which counters are exposed as sensors
- Adjust update interval — set how often counter readings are refreshed
- Default: 30 minutes
- Range: 1–1440 minutes (1 minute to 24 hours)
- Lower intervals mean more frequent updates but higher API usage
Changes take effect after saving and the integration automatically reloads.
One device per configured CEM account.
-
Account
sensor.cem_account_<slug>_<company_id>_account
Attributes:company_idcustomer_idperson_idcompany_namedisplay_namelogin_valid_fromlogin_valid_to
-
Status
sensor.cem_account_<slug>_<company_id>_status
Attributes:token_expires_at_isocookie_presentcompany_id
One device per place (mis_id).
For each meter and selected counter, the integration exposes a sensor.
The exact entity IDs depend on the counter type, but follow this pattern:
-
Generic counter
sensor.cem_object_<slug>_<base_name>_<me_serial>Where:
<slug>= object name slugified (e.g.,a_133)<base_name>= counter type key (lt_key) slugified (e.g.,lb_poctyp_sv)<me_serial>= meter serial number (e.g.,41020614)
Attributes:
Company ID (fir_id)Place ID (mis_id)Place name (mis_nazev)Meter ID (me_id)Meters serial (me_serial)Counter ID (var_id)Counter description (poc_desc)Counter type ID (pot_id)Counter value type (cik_nazev)Unit (jed_zkr)Language key for counter type name (lt_key)Readout timestampLast updated
Example structure:
CEM Account <DISPLAY_NAME>
├─ sensor.cem_account_<slug>_<company_id>_status
└─ sensor.cem_account_<slug>_<company_id>_account
CEM Object <OBJECT_NAME>
├─ sensor.cem_object_<slug>_<base_name>_<me_serial>
└─ sensor.cem_object_<slug>_<base_name>_<me_serial>
The integration performs read‑only HTTP calls against the CEM API. All API endpoints and their usage are detailed in the Architecture Documentation. The integration is designed to keep API load minimal by using batch requests and caching counter type metadata (7-day TTL, persists across Home Assistant reloads).
For more details about the CEM API, see the public API documentation:
For more detailed information, see:
- Architecture Documentation - Detailed architecture overview, coordinator hierarchy, API endpoints, and data flow
- Development Guide - Setup instructions for developers, testing, and contribution guidelines
- Project Review - Comprehensive project review and enhancement suggestions
- Contributing Guidelines - How to contribute to this project
- Changelog - Version history and changes
The integration uses a coordinator-based architecture following Home Assistant's best practices. Coordinators manage data fetching, caching, and updates for different aspects of the CEM API.
Key Components:
- Authentication Coordinator: Handles login and token management with automatic refresh
- Metadata Coordinators: Fetch account info, objects, meters, and counters (updated every 12 hours)
- Counter Reading Coordinators: Fetch latest counter values via batch API (configurable interval, default: 30 minutes)
- Batch API Support: Minimizes API calls by fetching multiple counter readings in a single request
- Persistent Caching: Counter type metadata cached with 7-day TTL to reduce API load
For detailed architecture documentation including coordinator hierarchy, API endpoints, data flow diagrams, and design decisions, see docs/ARCHITECTURE.md.
Call a CEM API endpoint and receive the raw JSON response via a Home Assistant event. This service is useful for debugging and inspecting the CEM API responses.
Service Data:
endpoint(required): The CEM endpoint to call. Available options:user_info— User/company information (id=9)objects— List of objects/places (id=23)meters— List of meters (id=108)counters_by_meter— Counters for a specific meter (id=107)counter_last— Last reading for a specific counter (id=8)
mis_id(optional): Object ID, required formetersendpointme_id(optional): Meter ID, required forcounters_by_meterendpointvar_id(optional): Counter ID, required forcounter_lastendpoint
Event:
After calling the service, a cem_monitor_raw_response event is fired with:
endpoint: The endpoint that was calleddata: The raw JSON response from the CEM APIcontext_id: The context ID of the service call
Example:
service: cem_monitor.get_raw
data:
endpoint: counter_last
var_id: 104437Then listen for the event:
event: cem_monitor_raw_response-
Names not updating
Try removing the device from Home Assistant, then reload the integration. -
Statistics warnings after unit changes
If units were changed in a newer version, you may need to clear or realign old statistics in Home Assistant. -
Missing serial numbers
Some meters in CEM do not exposeme_serial. In that case, entity names fall back tome_id. -
No counters or missing entities
- Verify the CEM web portal shows meters and counters for your account.
- Check Home Assistant logs for messages from
custom_components.cem_monitor. - Remember that only counters you selected during setup (or in options) are exposed. If you want to add more counters, use the Configure option in the integration settings.
-
Counter not showing up
- The counter may not have been selected during setup. Go to Settings → Devices & Services → CEM Monitoring Integration → Configure and ensure the counter is selected.
- Some counter types (state counters like door/contact sensors) are automatically excluded. Only numeric counters (instantaneous, cumulative, and derived) are exposed.
-
Counters not updating
- Check the update interval setting in the integration options (default: 30 minutes).
- If you need more frequent updates, reduce the interval (minimum: 1 minute). Note that very short intervals may increase API load.
- Check Home Assistant logs for any errors during refresh.
-
Too many API calls
- Increase the counter update interval in the integration options to reduce API usage.
- Consider selecting only the counters you actually need rather than all available counters.
- Credentials are stored and managed by Home Assistant.
- Only read‑only CEM API calls are used.
- No data is sent to any third‑party services other than CEM itself.
This is an unofficial Home Assistant integration.
It is provided as‑is by the community. Use at your own risk.
MIT