Any way in the next version we can get an alarm time delay field, or in my case all I want is a checkbox to disable the alarm, I dont need/want it beeping.
though not sure if this is normal or not, i did a test to auto shutdown.it went through the shut down process then it stopped for me to manually reboot or shutdownthe operating system has haltedplease press any key to rebootis there anything i can do to fully shutdown the device?thanks
#!/usr/bin/env shset -eprintf "Beginning Shutdown Sequence" | wall/sbin/shutdown -p now "apcupsd initiated shutdown"# 99 prevents apccontrol from executing the default doshutdown actionexit 99
Quote from: i1mran92 on August 06, 2022, 01:35:42 pmthough not sure if this is normal or not, i did a test to auto shutdown.it went through the shut down process then it stopped for me to manually reboot or shutdownthe operating system has haltedplease press any key to rebootis there anything i can do to fully shutdown the device?thanksapcupsd actions (not the plugin) are controlled via the /usr/local/etc/apcupsd/apccontrol script.Weirdly the FreeBSD version uses "shutdown -h now" instead of "shutdown -p now". I cannot change that in the plugin.As a workaround, the apccontrol scripts permits overriding the default actions by creating another script named after the action (in this case "doshutdown") inside the /usr/local/etc/apcupsd/ directory.For example you can create the script /usr/local/etc/apcupsd/doshutdown and make it executable otherwise it wont be executed by apccontrol.Code: [Select]#!/usr/bin/env shset -eprintf "Beginning Shutdown Sequence" | wall/sbin/shutdown -p now "apcupsd initiated shutdown"# 99 prevents apccontrol from executing the default doshutdown actionexit 99
thank you. was able to make it shutdown fully with the script.though i dont actually see "begining Shutdown Sequest" and "apcupsd initiated shutdown" when the shutdown procees was happening. not sure why?but atleast it is fully shutting down now.
logger -t apcupsd "some message"
Just installed an RJ45 --> USB cable between my APC CS 500 and my OPNSense. What am I supposed to choose in the settings for (current choice):UPS cable type (Smart)UPS type (apcsmart)
Could anyone say something on the new widgets support (>24.7)?I updated my instance a few days ago and the widget is gone. Turns out you need a new kind of widget now.Does this plugin even get support still? The latest commit was 2 years ago.Could we maybe all contribute a little?I'm a web dev, I could make the UI work, though I have no idea of how to develop opnsense plugins.
/usr/local/opnsense/www/js/widgets
/* * Copyright (C) 2024 David Berry. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */import BaseTableWidget from "./BaseTableWidget.js";export default class Apcupsd extends BaseTableWidget { constructor() { super(); this.dataError = false; this.data = null; this.statusColor = this.translations['t_statusColorWarning']; this.statusText = this.translations['t_statusTextWaiting']; this.statusName = this.translations['t_statusNameOffline']; } getGridOptions() { return { // trigger overflow-y:scroll after 650px height sizeToContent: 650, } } getMarkup() { let $container = $('<div></div>'); let $apcupsdTable = this.createTable('apcupsd-table', { headerPosition: 'left', }); $container.append($apcupsdTable); return $container; } async onWidgetTick() { this.dataError = false; this.statusColor = this.translations['t_statusColorSuccess']; this.statusText = this.translations['t_statusNameOnline']; this.statusName = this.translations['t_statusNameOnline']; this.data = await this.ajaxCall('/api/apcupsd/service/getUpsStatus'); if (!this.data) { $(`.${this.id}-chart-container`).html(` <a href="/system_advanced_misc.php">${this.translations.t_unconfigured}</a> `).css('margin', '2em auto') this.dataError = true; this.statusColor = this.translations['t_statusColorDanger']; this.statusText = this.translations['t_statusTextError']; this.statusName = this.translations['t_statusNameOffline']; } if (this.data.status === null) { this.dataError = true; this.statusColor = this.translations['t_statusColorDanger']; this.statusText = this.translations['t_statusTextOffline']; this.statusName = this.translations['t_statusNameOffline']; } else { this.statusName = this.data['status']['MODEL']['value']; } let rows = []; let upsStatusLight = `<div> <i class="fa fa-circle text-muted ${this.statusColor} ups-status-icon" style="font-size: 11px; cursor: pointer;" data-toggle="tooltip" title=${this.statusText}> </i> ${this.statusName} </div>` rows.push([upsStatusLight, '']); if (this.dataError) { rows.push([this.translations['t_unable_to_connect'], this.data['error']]); } else { rows.push([this.translations['t_mode'], this.data['status']['UPSMODE']['value']]); rows.push([this.translations['t_status'], this.data['status']['STATUS']['value']]); rows.push([this.translations['t_battery_runtime'], this.data['status']['TIMELEFT']['value']]); rows.push([this.translations['t_load'], this.data['status']['LOADPCT']['value']]); rows.push([this.translations['t_int_temp'], this.data['status']['ITEMP']['value']]); } super.updateTable('apcupsd-table', rows); }}
/usr/local/opnsense/www/js/widgets/Metadata/Apcupsd.xml
<metadata> <Apcupsd> <filename>Apcupsd.js</filename> <endpoints> <endpoint>/api/Apcupsd/getUpsStatus</endpoint> </endpoints> <translations> <title>APC UPS Status</title> <t_unconfigured>APC UPS is not available or not configured.</t_unconfigured> <t_statusColorSuccess>text-success</t_statusColorSuccess> <t_statusColorWarning>text-warning</t_statusColorWarning> <t_statusColorDanger>text-danger</t_statusColorDanger> <t_statusTextWaiting>Waiting</t_statusTextWaiting> <t_statusTextOffline>Offline</t_statusTextOffline> <t_statusTextError>Data fetch error</t_statusTextError> <t_statusNameOffline>Offline</t_statusNameOffline> <t_statusNameOnline>Online</t_statusNameOnline> <t_mode>Mode</t_mode> <t_status>Status</t_status> <t_battery_runtime>Battery Runtime</t_battery_runtime> <t_load>Load</t_load> <t_int_temp>Internal Temperature</t_int_temp> <t_unable_to_connect>Unable to connect</t_unable_to_connect> </translations> </Apcupsd></metadata>