Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions bundles/org.openhab.binding.tibber/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ After initial setup the average values will stay NULL until the next day because
Please note time series are not supported by the default [rrd4j](https://www.openhab.org/addons/persistence/rrd4j/) persistence.
The items connected to the above channels needs to be stored in e.g. [InfluxDB](https://www.openhab.org/addons/persistence/influxdb/) or [InMemory](https://www.openhab.org/addons/persistence/inmemory/).

#### Trigger Channels

Channel `event` can trigger the following events:

| Event | Description |
|----------------------|--------------------------------|
| DAY_AHEAD_AVAILABLE | Day-ahead prices are available |

### `live` group

Live information from Tibber Pulse.
Expand Down Expand Up @@ -475,3 +483,14 @@ Number:Energy Tibber_API_Total_Production "Total Productio
Number:Energy Tibber_API_Daily_Production "Daily Production" {channel="tibber:tibberapi:xyz:statistics#daily-production"}
Number:Energy Tibber_API_Last_Hour_Production "Last Hour Production" {channel="tibber:tibberapi:xyz:statistics#last-hour-production"}
```

### Rule listen to day-ahead price update

```java
rule "Tibber day-ahead prices available"
when
Channel 'tibber:tibberapi:xyz:price#event' triggered
then
logInfo("Tibber Update","Price event {}", receivedEvent)
end
```
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class TibberBindingConstants {
public static final String CHANNEL_TAX = "tax";
public static final String CHANNEL_PRICE_LEVELS = "level";
public static final String CHANNEL_AVERAGE = "average";
public static final String CHANNEL_EVENT = "event";

// live channels
public static final String CHANNEL_CONSUMPTION = "consumption";
Expand All @@ -78,6 +79,9 @@ public class TibberBindingConstants {
public static final String CHANNEL_DAILY_PRODUCTION = "daily-production";
public static final String CHANNEL_LAST_HOUR_PRODUCTION = "last-hour-production";

// List of all events
public static final String EVENT_DAY_AHEAD_AVAILABLE = "DAY_AHEAD_AVAILABLE";

public static final Map<String, String> PRICE_COST_CHANNELS = Map.of(
CHANNEL_GROUP_PRICE + ChannelUID.CHANNEL_GROUP_SEPARATOR + CHANNEL_TOTAL_PRICE, "price",
CHANNEL_GROUP_PRICE + ChannelUID.CHANNEL_GROUP_SEPARATOR + CHANNEL_SPOT_PRICE, "price",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ private void updateSpotPrices() {

if (!priceInfo.isEmpty()) {
try {
boolean updateTrigger = false;
// now check if tomorrows prices are updated for the given hour
if (tibberConfig.updateHour <= Instant.now().atZone(timeZoneProvider.getTimeZone()).getHour()) {
JsonArray tomorrowPrices = priceInfo.getAsJsonArray("tomorrow");
Expand All @@ -383,6 +384,7 @@ private void updateSpotPrices() {
} else {
logger.debug("update found - continue");
retryCounter = 0;
updateTrigger = true;
}
}
JsonArray spotPrices = new JsonArray();
Expand Down Expand Up @@ -435,6 +437,10 @@ private void updateSpotPrices() {
});
averageCache = avgSeries;
sendTimeSeries(new ChannelUID(thing.getUID(), CHANNEL_GROUP_PRICE, CHANNEL_AVERAGE), avgSeries);
if (updateTrigger) {
triggerChannel(new ChannelUID(thing.getUID(), CHANNEL_GROUP_PRICE, CHANNEL_EVENT),
EVENT_DAY_AHEAD_AVAILABLE);
}
updateStatus(ThingStatus.ONLINE);
} catch (JsonSyntaxException | DateTimeParseException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ channel-type.tibber.energy-detailed.label = Total Consumption
channel-type.tibber.energy-detailed.description = Consumption at given time interval (e.g. hourly, daily, last meter reading, accumulated since midnight)
channel-type.tibber.energy.label = Total Consumption
channel-type.tibber.energy.description = Consumption at given time interval (e.g. hourly, daily, last meter reading, accumulated since midnight)
channel-type.tibber.event.label = Event
channel-type.tibber.event.description = Event triggered
channel-type.tibber.power.label = Power Consumption/Production
channel-type.tibber.power.description = Power consumption/production for given time interval
channel-type.tibber.price-level.label = Price Level
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,14 @@
</tags>
<state readOnly="true" pattern="%.0f %unit%"></state>
</channel-type>
<channel-type id="event">
<kind>trigger</kind>
<label>Event</label>
<description>Event triggered</description>
<event>
<options>
<option value="DAY_AHEAD_AVAILABLE">Day-ahead prices are available</option>
</options>
</event>
</channel-type>
</thing:thing-descriptions>
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<label>Average 24h</label>
<description>Average price from last 24 hours</description>
</channel>
<channel id="event" typeId="event"/>
</channels>
</channel-group-type>
</thing:thing-descriptions>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<properties>
<property name="vendor">Tibber</property>
<property name="thingTypeVersion">6</property>
<property name="thingTypeVersion">7</property>
</properties>

<config-description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@
<description>(DEPRECATED) Use total channel from price group</description>
</update-channel>
</instruction-set>

<instruction-set targetVersion="7">
<add-channel id="event" groupIds="price">
<type>tibber:event</type>
</add-channel>
</instruction-set>
</thing-type>

</update:update-descriptions>