Skip to content

Commit

Permalink
fixed timer period off low battery charge
Browse files Browse the repository at this point in the history
  • Loading branch information
chpro committed Apr 1, 2024
1 parent cc8dcc0 commit 18c15b5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const CONFIG = {
timerPeriodManually: Number(process.env.TIMER_PERIOD_MANUALLY) || 60 * MINUTE,
timerPeriodOffFallback: Number(process.env.TIMER_PERIOD_OFF_FALLBACK) || 10 * MINUTE,
timerPeriodOffPrimarySourceActive: Number(process.env.TIMER_PERIOD_OFF_PRIMARY_SOURCE_ACTIVE) || 12 * 60 * MINUTE,
timerPeriodOffLowBatteryCharge: Number(process.env.TIMER_PERIOD_OFF_LOW_BATTERY_CHARGE) || 10 * MINUTE,
};

module.exports = {CONFIG}
2 changes: 1 addition & 1 deletion app/switchstatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const SWITCH_STATUS = {
OFF_FALLBACK: {on: false, status: -4, message: "Off due to no value for energy production was available and time outside fallback operating hours", timerPeriod: CONFIG.timerPeriodOffFallback},
OFF_FORECAST: {on: false, status: -5, message: "Off due to too low energy production within the forecast fallback operating mode", timerPeriod: CONFIG.timerPeriodOffFallback},
OFF_PRIMARY_SOURCE_ACTIVE: {on: false, status: -6, message: "Off due to too another appliance is enabled and producing hot water", timerPeriod: CONFIG.timerPeriodOffPrimarySourceActive},
OFF_LOW_BATTERY_CHARGE: {on: false, status: -7, message: "Off due to too low battery charge", timerPeriod: CONFIG.timerPeriodOffPrimarySourceActive},
OFF_LOW_BATTERY_CHARGE: {on: false, status: -7, message: "Off due to too low battery charge", timerPeriod: CONFIG.timerPeriodOffLowBatteryCharge},
};

module.exports = {SWITCH_STATUS}
7 changes: 6 additions & 1 deletion app/webservice.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const hrc = require('./control')
const dataProvider = require('./influxdataprovider')
const CONFIG = require('./config').CONFIG
const SWITCH_STATUS = require('./switchstatus').SWITCH_STATUS
const express = require('express')
Expand All @@ -14,7 +15,11 @@ var corsOptions = {
ws.use(cors(corsOptions))

ws.get('/config', (req, res) => {
res.json({"config": CONFIG, "status": SWITCH_STATUS})
hrc.switch0.get(function(switchOn) {
dataProvider.getCurrentStatusValues(switchOn, function(currentStatusValues) {
res.json({"values": currentStatusValues, "config": CONFIG, "status": SWITCH_STATUS})
});
});
})

ws.get('/switchStatus', (req, res) => {
Expand Down

0 comments on commit 18c15b5

Please sign in to comment.