Skip to content

Commit

Permalink
npm test
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkjanfaber committed Nov 6, 2024
1 parent 13ece4e commit 7102aa9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion scripts/node-palette.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ for (const node of nodes) {
i++
}

output.nodes.push({ type: 'victron-virtual', name: 'Virtual device', z: '1234567891', id: '1234567891', x: 370, y: 620})
output.nodes.push({ type: 'victron-virtual', name: 'Virtual device', z: '1234567891', id: '1234567891', x: 370, y: 620 })

console.log(JSON.stringify(output))
11 changes: 4 additions & 7 deletions src/nodes/victron-virtual.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ module.exports = function (RED) {
if (address && address.length === 2) {
this.address = `tcp:host=${address[0]},port=${address[1]}`
}
const timeoutHandle = null

// Connnect to the dbus
if (this.address) {
Expand All @@ -183,7 +182,7 @@ module.exports = function (RED) {
}

if (!config.device || config.device === '') {
throw new Error ('Node needs a configuration first')
throw new Error('Node needs a configuration first')
}

let serviceName = `com.victronenergy.${config.device}.virtual_${this.id}`
Expand Down Expand Up @@ -274,9 +273,9 @@ module.exports = function (RED) {
})
}
text = `Virtual ${iface.NrOfPhases}-phase grid meter`
}
break
case 'tank': {
}
case 'tank':
iface.FluidType = Number(config.fluid_type ?? 1) // Fresh water
if (!config.include_tank_battery) {
delete ifaceDesc.properties.BatteryVoltage
Expand All @@ -297,9 +296,8 @@ module.exports = function (RED) {
iface.Capacity = capacity
}
text = `Virtual ${properties.tank.FluidType.format(iface.FluidType).toLowerCase()} tank sensor`
}
break
case 'temperature': {
case 'temperature':
iface.TemperatureType = Number(config.temperature_type ?? 2) // Generic
// Remove optional properties if not enabled
if (!config.include_humidity) {
Expand All @@ -317,7 +315,6 @@ module.exports = function (RED) {
iface.BatteryVoltage = Number(config.temp_battery_voltage) || 3.3
}
text = `Virtual ${properties.temperature.TemperatureType.format(iface.TemperatureType).toLowerCase()} temperature sensor`
}
break
}

Expand Down

0 comments on commit 7102aa9

Please sign in to comment.