# Senec Home Binding

Binding to request status information from Senec Home Batteries to allow home automation decisions based on your current energy management.

If your power feed is limited by regulations for example, you can switch on devices if a limited rate was applied by your Senec Home device.
In addition you can switch off devices if the power consumption is getting higher.

Examples: Lights, pool filters, wash machines, ...

## Supported Things

| Thing type id        | Name                                          |
|----------------------|-----------------------------------------------|
| senechome            | Senec Home Lithium Battery, V2.0, V2.1, V3 and V3duo |

**Note:** Not all channels are available for all Senec Home types. E.g. 

* only V3, V3duo have a power generator and thus MPPs (V3 has 2 MPP, V3duo has 3 MPP)
* not equipped battery packs will return 0 for all ...Pack channels
* currently channels for the first wallbox are implemented (senec could handle 4 wallboxes)

## Thing Configuration

demo.things

```
Thing senechome:senechome:pvbattery [ hostname="192.168.0.128", refreshInterval=60, limitationTresholdValue=70, limitationDuration=60 ]
```

If the thing goes online then the connection to the web interface is successful.
In case it is offline you should see an error message.
The refresh interval is 15 seconds by default, but you can optionally provide your own value adding the `refreshInterval` key.

The property `limitationTresholdValue` is used as threshold for channel `powerLimitationState`. It is combined with property `limitationDuration` (seconds) to define a stable status for power limitation. Therefor use `powerLimitationState` to trigger Events (switches) based on your current power limitation.

## Channels

| Channel               | Type      | Description                                                              |
|-----------------------|-----------|--------------------------------------------------------------------------|
| powerLimitation       | percent   | How much is your pv generator limited (0% if not limited anyway)         |
| powerLimitationState  | ON/OFF    | Power limitation active (based on configuration)                         |
| currentMPP1           | ampere    | PV generator current on MPP1                                             |
| currentMPP2           | ampere    | PV generator current on MPP2                                             |
| currentMPP3           | ampere    | PV generator current on MPP3                                             |
| powerMPP1             | watt      | PV generator power on MPP1                                               |
| powerMPP2             | watt      | PV generator power on MPP2                                               |
| powerMPP3             | watt      | PV generator power on MPP3                                               |
| voltageMPP1           | volt      | PV generator voltage on MPP1                                             |
| voltageMPP2           | volt      | PV generator voltage on MPP2                                             |
| voltageMPP3           | volt      | PV generator voltage on MPP3                                             |
| houseConsumption      | watt      | Current power consumption of your house/living                           |
| energyProduction      | watt      | Energy generated by your pv / inverter                                   |
| batteryPower          | watt      | Energy processed by battery negative discharge, positive charge          |
| batteryCurrent        | ampere    | Battery current negative discharge, positive charge                      |
| batteryVoltage        | volt      | Battery Voltage                                                          |
| batteryFuelCharge     | percent   | Fuel charge of your battery (0 - 100%)                                   |
| systemState           |           | Text describing current action of the senec home system (e.g. CHARGE)    |
| systemStateValue      |           | Value describing current action of the senec home system (e.g. 14)       |
| gridPower             | watt      | Grid power level, negative for supply, positive values for drawing power |
| gridPowerDraw         | watt      | Absolute power level of power draw, zero while supplying                 |
| gridPowerSupply       | watt      | Absolute power level of power supply, zero while drawing                 |
| gridPowerPhase1       | watt      | Grid power level on Phase 1, negative for supply, positive for drawing   |
| gridPowerPhase2       | watt      | Grid power level on Phase 2, negative for supply, positive for drawing   |
| gridPowerPhase3       | watt      | Grid power level on Phase 3, negative for supply, positive for drawing   |
| gridCurrentPhase1     | ampere    | Grid current on Phase 1, always a positive number                        |
| gridCurrentPhase2     | ampere    | Grid current on Phase 2, always a positive number                        |
| gridCurrentPhase3     | ampere    | Grid current on Phase 3, always a positive number                        |
| gridVoltagePhase1     | volt      | Grid voltage on Phase 1                                                  |
| gridVoltagePhase2     | volt      | Grid voltage on Phase 2                                                  |
| gridVoltagePhase3     | volt      | Grid voltage on Phase 3                                                  |
| gridFrequency         | hertz     | Grid frequency                                                           |
| liveBatCharge         | kilo watt hour | Live Total Bat Charge                                               |
| liveBatDischarge      | kilo watt hour | Live Total Bat Discharge                                            |
| liveGridImport        | kilo watt hour | Live Total Grid Import                                              |
| liveGridExport        | kilo watt hour | Live Total Grid Export                                              |
| liveHouseConsumption  | kilo watt hour | Live Total House Consumption (without WB)                           |
| livePowerGenerator    | kilo watt hour | Live Total PV generator generated energy                            |
| liveEnergyWallbox1    | kilo watt hour | Live Total Wallbox 1 charged energy                                 |
| chargedEnergyPack1    | kilo watt hour | total charged energy battery pack 1                                 |
| chargedEnergyPack2    | kilo watt hour | total charged energy battery pack 2                                 |
| chargedEnergyPack3    | kilo watt hour | total charged energy battery pack 3                                 |
| chargedEnergyPack4    | kilo watt hour | total charged energy battery pack 4                                 |
| dischargedEnergyPack1 | kilo watt hour | total discharged energy battery pack 1                              |
| dischargedEnergyPack2 | kilo watt hour | total discharged energy battery pack 2                              |
| dischargedEnergyPack3 | kilo watt hour | total discharged energy battery pack 3                              |
| dischargedEnergyPack4 | kilo watt hour | total discharged energy battery pack 4                              |
| cyclesPack1           |           | battery charge/discharge cycles pack 1                                   |
| cyclesPack2           |           | battery charge/discharge cycles pack 2                                   |
| cyclesPack3           |           | battery charge/discharge cycles pack 3                                   |
| cyclesPack4           |           | battery charge/discharge cycles pack 4                                   |
| currentPack1          | ampere    | battery current pack 1                                                   |
| currentPack2          | ampere    | battery current pack 2                                                   |
| currentPack3          | ampere    | battery current pack 3                                                   |
| currentPack4          | ampere    | battery current pack 4                                                   |
| voltagePack1          | volt      | battery voltage pack 1                                                   |
| voltagePack2          | volt      | battery voltage pack 2                                                   |
| voltagePack3          | volt      | battery voltage pack 3                                                   |
| voltagePack4          | volt      | battery voltage pack 4                                                   |
| maxCellVoltagePack1   | volt      | maximum cell voltage battery pack 1                                      |
| maxCellVoltagePack2   | volt      | maximum cell voltage battery pack 2                                      |
| maxCellVoltagePack3   | volt      | maximum cell voltage battery pack 3                                      |
| maxCellVoltagePack4   | volt      | maximum cell voltage battery pack 4                                      |
| minCellVoltagePack1   | volt      | minimum cell voltage battery pack 1                                      |
| minCellVoltagePack2   | volt      | minimum cell voltage battery pack 2                                      |
| minCellVoltagePack3   | volt      | minimum cell voltage battery pack 3                                      |
| minCellVoltagePack4   | volt      | minimum cell voltage battery pack 4                                      |
| batteryTemperature    | celsius   | battery temperature (maximum of all battery packs)                       |
| caseTemperature       | celsius   | case temperature                                                         |
| mcuTemperature        | celsius   | MCU (main control unit) temperature                                      |
| wallbox1State         |           | Wallbox 1 state as Text (e.g. Charging)                                  |
| wallbox1StateValue    |           | Wallbox 1 state as value (e.g. 194)                                      |
| wallbox1ChargingCurrentPhase1 | ampere | Wallbox 1 charging current Phase 1                                  |
| wallbox1ChargingCurrentPhase2 | ampere | Wallbox 1 charging current Phase 2                                  |
| wallbox1ChargingCurrentPhase3 | ampere | Wallbox 1 charging current Phase 3                                  |
| wallbox1ChargingPower         | watt   | Wallbox 1 charging power                                            |

## Items

Sample:

```
Number SenecPowerLimitation      "pv generator limit [%d %%]"                <heating> { channel="senechome:senechome:pvbattery:powerLimitation" }
Switch SenecPowerLimitationState "Power limitation active"                    <switch> { channel="senechome:senechome:pvbattery:powerLimitationState" }
Number SenecHouseConsumption     "Current power consumption [%d W]"           <energy> { channel="senechome:senechome:pvbattery:houseConsumption" }
Number SenecEnergyProduction     "Energy generated by pv [%d W]"              <energy> { channel="senechome:senechome:pvbattery:energyProduction" }
Number SenecBatteryPower         "Energy processed by battery [%d W]"         <energy> { channel="senechome:senechome:pvbattery:batteryPower" }
Number SenecBatteryFuelCharge    "State of Charge [%d %%]"              <batterylevel> { channel="senechome:senechome:pvbattery:batteryFuelCharge" }
String SenecSystemState          "Current system state [%s]"                    <text> { channel="senechome:senechome:pvbattery:systemState" }
Number SenecSystemStateValue     "Current system state [%d]"                    <text> { channel="senechome:senechome:pvbattery:systemStateValue" }
Number SenecGridPower            "Grid power level [%d W]"                    <energy> { channel="senechome:senechome:pvbattery:gridPower" }
Number SenecGridPowerDraw        "Power draw from grid [%d W]"                <energy> { channel="senechome:senechome:pvbattery:gridPowerDraw" }
Number SenecGridPowerSupply      "Power supply to grid [%d W]"                <energy> { channel="senechome:senechome:pvbattery:gridPowerSupply" }
Number SenecGridPowerPh1         "Power draw from grid on Phase 1 [%d W]"     <energy> { channel="senechome:senechome:pvbattery:gridPowerPhase1" }
Number SenecGridPowerPh2         "Power draw from grid on Phase 2 [%d W]"     <energy> { channel="senechome:senechome:pvbattery:gridPowerPhase2" }
Number SenecGridPowerPh3         "Power draw from grid on Phase 3 [%d W]"     <energy> { channel="senechome:senechome:pvbattery:gridPowerPhase3" }
Number SenecGridCurrentPh1       "Current draw from grid on Phase 1 [%.2f A]" <energy> { channel="senechome:senechome:pvbattery:gridCurrentPhase1" }
Number SenecGridCurrentPh2       "Current draw from grid on Phase 2 [%.2f A]" <energy> { channel="senechome:senechome:pvbattery:gridCurrentPhase2" }
Number SenecGridCurrentPh3       "Current draw from grid on Phase 3 [%.2f A]" <energy> { channel="senechome:senechome:pvbattery:gridCurrentPhase3" }
Number SenecGridVoltagePh1       "Voltage Level on Phase 1 [%d V]"            <energy> { channel="senechome:senechome:pvbattery:gridVoltagePhase1" }
Number SenecGridVoltagePh2       "Voltage Level on Phase 2 [%d V]"            <energy> { channel="senechome:senechome:pvbattery:gridVoltagePhase2" }
Number SenecGridVoltagePh3       "Voltage Level on Phase 3 [%d V]"            <energy> { channel="senechome:senechome:pvbattery:gridVoltagePhase3" }
Number SenecGridFrequency        "Grid Frequency [%.2f Hz]"                   <energy> { channel="senechome:senechome:pvbattery:gridFrequency" }
Number SenecBatteryVoltage       "Battery Voltage [%.1f V]"                   <energy> { channel="senechome:senechome:pvbattery:batteryVoltage" }
Number SenecLiveBatCharge        "Live Bat Charge [%d kWh]"                   <energy> { channel="senechome:senechome:pvbattery:liveBatCharge" }
Number SenecLiveBatDischarge     "Live Bat Discharge [%d kWh]"                <energy> { channel="senechome:senechome:pvbattery:liveBatDischarge" }
Number SenecLiveGridImport       "Live Grid Import [%d kWh]"                  <energy> { channel="senechome:senechome:pvbattery:liveGridImport" }
Number SenecLiveGridExport       "Live Grid Export [%d kWh]"                  <energy> { channel="senechome:senechome:pvbattery:liveGridExport" }
```

## Sitemap

Sample:

```
Text label="Power Grid"{
    Frame label="Photovoltaik" {
        Default item=SenecPowerLimitation
        Default item=SenecPowerLimitationState
        Default item=SenecHouseConsumption
        Default item=SenecEnergyProduction
        Default item=SenecBatteryPower
        Default item=SenecBatteryFuelCharge
        Default item=SenecSystemState
        Default item=SenecSystemStateValue
        Default item=SenecGridPower
        Default item=SenecGridPowerDraw
        Default item=SenecGridPowerSupply
        Default item=SenecGridPowerPh1
        Default item=SenecGridPowerPh2
        Default item=SenecGridPowerPh3
        Default item=SenecGridCurrentPh1
        Default item=SenecGridCurrentPh2
        Default item=SenecGridCurrentPh3
        Default item=SenecGridVoltagePh1
        Default item=SenecGridVoltagePh2
        Default item=SenecGridVoltagePh3
        Default item=SenecGridFrequency
        Default item=SenecBatteryVoltage
        Default item=SenecLiveBatCharge
        Default item=SenecLiveBatDischarge
        Default item=SenecLiveGridImport
        Default item=SenecLiveGridExport
    }
}
```
