Skip to content

Instantly share code, notes, and snippets.

@fabdrol
Last active July 4, 2017 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabdrol/319af11f1cf5919fc6028c91686b1ab1 to your computer and use it in GitHub Desktop.
Save fabdrol/319af11f1cf5919fc6028c91686b1ab1 to your computer and use it in GitHub Desktop.
Signal K switching [draft] proposal
// This lives in $.vessel.<UUID|MMSI>.electrical
{
// For the sake of simplicity, I'm consider a "fuse" and a "circuit breaker" to be the same (conceptually, not technically)
fuses: {
'3b4aa0a9-d12a-4c50-8082-eebc93ec427d': {
type: 'bosch', // enum: blade, bosch, circuit-breaker, embedded, other?
speed: 'fast', // enum: slow-blow, fast, ultrafast, other?
ratedCurrent: 15, // A
ratedVoltage: 12, // V
state: 'tripped', // enum: tripped, normal
meta: {
location: 'aft technical cabinet',
dateInstalled: '2017-07-04T07:19:49.239Z',
manufacturer: {
name: 'E.T.A.',
model: 'MiniPlex',
},
displayName: 'Owner\'s Cabin Lights',
longName: 'Cabin lights in the Owner\'s Cabin',
warnMethod: ['visual', 'sound'],
zones: [ // Not sure this works for fuses. @rob42?
"tripped", // lower.. currently doesn't allow strings.
"normal", // upper.. currently doesn't allow string.
// when is alarm tripped? at lower or upper? I don't get this.
{
state: 'normal', // enum: normal, alert, warn, alarm, emergency. Should go to "warn" when fuse state hits "tripped". But how?
message: 'The fuse has been tripped. Please check out the fault.',
}
]
}
}
},
// A switch is actually anything that can control an electrical circuit - such as a push button, a dimmer, etc.
// Is switch the right word?
// Switches are grouped by where the switch is. By separating switch from switchable, one switchable could have many switches
switch: {
'owners-cabin': {
'c8ac9a4d-c66e-425e-99b7-b24fdd18fedf': {
switchable: '75af06cf-49b1-4fbc-8e9c-0d9f2dcaf5ed',
type: 'modes-toggle', // enum: toggle, modes-toggle, dimmer, other types?
state: 1, // 0 - 1
defaultState: 0,
meta: {
displayName: 'Owner\'s Cabin light switch',
longName: 'Ceiling light switch in the Owner\'s Cabin',
shortName: 'Lights',
location: 'Owner\'s Cabin',
modes: [
{
state: 0,
name: "Off",
},
{
state: 0.5,
name: "Medium intensity",
},
{
state: 1,
name: "High intensity",
}
],
},
},
// Should this be allowed? If we generate the UI, one wants meta info on the switch bank too
meta: {
displayName: 'Owner\'s Cabin control panel',
longName: 'Control panel in the Owner\'s Cabin',
shortName: 'Controls',
location: 'Owner\'s Cabin',
}
},
bridge: {
'774843f2-252b-4b00-aebf-7b755013439d': {
switchable: '75af06cf-49b1-4fbc-8e9c-0d9f2dcaf5ed',
type: 'toggle', // enum: toggle, dimmer, other types?
state: 1, // 0 - 1
defaultState: 0,
meta: {
displayName: 'Bridge light switch',
longName: 'Ceiling light switch on the bridge for the Owner\'s Cabin',
shortName: 'Lights',
location: 'Bridge',
}
},
meta: {
displayName: 'Bridge main control panel',
longName: 'Control panel on the bridge',
shortName: 'Controls',
location: 'Bridge',
}
},
},
// A "switchable" is anything that can be controlled by a "switch".
// I couldn't think of a better term, maybe "circuit" or "device"? Although that's very generic...
// "switchables" are grouped by zone, location, type of device, whatever works for the boat in question.
switchables: {
'owners-cabin': {
'75af06cf-49b1-4fbc-8e9c-0d9f2dcaf5ed': {
fuse: '../fuses/3b4aa0a9-d12a-4c50-8082-eebc93ec427d', // Or just the UUID?
type: 'light', // very large enum or just a string?
ratedVoltage: 12,
ratedCurrent: 0.5,
state: 1, // 0 - 1, where 1 can be 100% if it's "dimmable", or 1 if it's a binary toggle, etc
meta: {
displayName: 'Owner\'s Cabin Lights',
longName: 'Ceiling lights in the Owner\'s Cabin',
shortName: 'Lights',
location: 'Owner\'s Cabin',
}
},
'6dc1e24d-0b32-4c1f-bcd0-e40504c078fb': {
fuse: '../fuses/f9a4d461-6756-40f8-ade3-da58617e4dc0', // Or just the UUID?
type: 'privacy-glass', // very large enum or just a string?
ratedVoltage: 12,
ratedCurrent: 2.0,
state: 0.7,
meta: {
displayName: 'Owner\'s Cabin Windows',
longName: 'Glass windows in the Owner\'s Cabin',
shortName: 'windows',
location: 'Owner\'s Cabin',
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment