Hello,
Is it possible to add the energy provider Urban Solar, which offers a virtual battery, as an integration?
I’m on it. Coming to the store soon ![]()
Hello everyone,
I present to you Urban Solar, an external integration for Gladys that allows you to monitor and control the Urban Solar virtual battery: kWh stock, stored and destocked energy, savings made, scenes, and widgets.
The Principle
With the Urban Solar offer, the solar energy you do not consume is injected into the grid and credited to a virtual battery. When you draw from the grid, it is first taken from this stock. Once the stock is empty, you pay the full price.
Urban Solar does not offer a public API. The integration therefore reconstructs this account from your meter readings, locally, to choose in the configuration:
- “Gladys Devices” (default): the energy tracking meter, a Shelly, or another integration’s clamp, with kWh or Wh index, and optional real-time power.
- “Shelly Meter”, read directly (Pro 3EM, 3EM Gen3, Pro EM, EM Gen3) placed on the network inlet: real-time power, no cloud, and nothing is lost in case of a power outage;
What It Brings
Two Devices
- Virtual Battery: stock (kWh), level (%), charging and discharging power, totals stored and destocked, savings (€), and a switch to suspend counting (change of meter, work…).
- Grid Connection: drawn and injected power, drawn and injected energy, and energy paid at full price.
Tariffs via Gladys Energy Contracts
No price needs to be entered in the integration. You create a contract “Urban Solar — Virtual Battery” in Gladys (network kWh price, destocking fees, subscriptions), and the integration uses it. In return, it calculates your consumption for Gladys: every half hour, the energy covered by the battery is counted at destocking fees, the rest at the network price. The energy dashboard thus displays what Urban Solar actually charges. When the tariff changes, a new contract is sufficient, and the past keeps its old prices.
Scene Triggers
- Battery state changed (charging, discharging, empty, idle)
- Low stock (adjustable threshold)
- Daily balance (stored, destocked, bought at full price, stock, savings)
Scene Actions
- Read the battery (stock, level, state, day’s figures, power…), for example to only start the water heater if the stock exceeds 50 kWh
- Refresh now
- Adjust the stock
- Suspend or resume counting
Two Dashboard Widgets
- Virtual Battery: gauge, stock, and real-time power, state, source, rate, savings, history, with the “Refresh” and “Adjust Stock” buttons.
- Energy Balance: day’s figures and totals, share of the draw covered by the battery, savings, pause/resume button.
The interface and documentation are available in
French,
English,
German, and
Spanish.
Installation
- Gladys 5.2 or newer.
- Install the Urban Solar integration from the integrations catalog.
- In its configuration, enter your Shelly’s address and click “Test Data Sources”.
- Create your “Urban Solar — Virtual Battery” energy contract and link it to your meter.
- Click “Adjust Stock” and enter the stock displayed in your Urban Solar customer area.
- Add the two devices from the Discovery tab, then the widgets to your dashboard.
To Know
- The figures are an estimate reconstructed from the readings. Your Urban Solar customer area is the official record: in case of discrepancy, simply adjust the stock again.
- For the local source, the Shelly API must be accessible without a password from the Gladys machine.
- Community integration, no link with Urban Solar Energy, Enedis, or Shelly.
Important point: you do not choose the device in the configuration screen. An external integration only sees its own devices: the SDK and the store do not provide any means to read those of other integrations. The device choice is therefore made via a Gladys scene:
- it triggers, for example, every 5 minutes;
- it reads the indexes with “Retrieve the last value of a device”;
- it transmits them to the new action “Urban Solar: Record a Meter Reading”.
Links
- Source code and documentation: GitHub - gboulvin/Gladys-Urban-Solar · GitHub
- Report a bug or suggest an idea: Issues · gboulvin/Gladys-Urban-Solar · GitHub
This is the first public version: I’m interested in your feedback, especially if you have another Shelly model or a particular Urban Solar configuration. Happy solar production! ![]()
A small question, but why not use a Lixee TIC or Zlinky, for example?
(post deleted by author)
Thanks for your feedback and logs, they explained everything! Your scene uses the action « Refresh the virtual battery ». With the source « Gladys devices », this action reads nothing: it’s the action « Urban Solar: save a meter reading » that transmits the indexes to the battery.
In your scene:
- « Retrieve the last value of a device » on the consumption index of the Ecojoko;
- same on a injection index, if you have one;
- « Urban Solar: save a meter reading », with in « Withdrawal index » (and « Injection index ») the variable proposed by the editor for these values, and the unit kWh.
Warning: the virtual battery fills with injected energy. If the Ecojoko only provides a consumption index, you will need another device that measures the injection (Shelly EM, clamp…), otherwise the stock will only decrease.
The next version writes each reading in the logs (Meter reading: …), and a rejected reading with its reason: we will see right away if something is wrong.
Hello, now that the integration is available, I took the liberty of renaming the topic and the category.