Skip to content

Instantly share code, notes, and snippets.

@theonetheycallneo
Created August 21, 2020 21:28
Show Gist options
  • Save theonetheycallneo/9215abc02c1df816321b2816b1e64e1e to your computer and use it in GitHub Desktop.
Save theonetheycallneo/9215abc02c1df816321b2816b1e64e1e to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const formatMachine = Machine({
"id": "DeviceService",
"context": {
"subscriptions": {}
},
"initial": "active",
"states": {
"active": {
"on": {
"subscribe": {
"actions": [
"createSubscription",
"subscribeDevice"
]
},
"unsubscribe": {
"actions": [
"deleteSubscription"
]
}
}
},
"devices": {
"type": "parallel",
"states": {
"LT1001": {
"id": "LT1001",
"initial": "active",
"context": {
"id": "5f3ff5116a586089805ae2fe",
"registerTransformers": {},
"spec": {
"deviceVersion": 1.1,
"registers": {
"deviceTypeStatus": {
"registerName": "deviceTypeStatus",
"registerType": "status",
"registerOffset": "0"
},
"deviceVersionStatus": {
"registerName": "deviceVersionStatus",
"registerType": "status",
"registerOffset": "1"
},
"scaledValueStatus": {
"registerName": "scaledValueStatus",
"registerType": "status",
"registerOffset": "2"
},
"alarmStatus": {
"registerName": "alarmStatus",
"registerType": "status",
"registerOffset": "3"
},
"hhighAlarmStatus": {
"registerName": "hhighAlarmStatus",
"registerType": "status",
"registerOffset": "3.0"
},
"highAlarmStatus": {
"registerName": "highAlarmStatus",
"registerType": "status",
"registerOffset": "3.1"
},
"lowAlarmStatus": {
"registerName": "lowAlarmStatus",
"registerType": "status",
"registerOffset": "3.2"
},
"llowAlarmStatus": {
"registerName": "llowAlarmStatus",
"registerType": "status",
"registerOffset": "3.3"
},
"lllowAlarmStatus": {
"registerName": "lllowAlarmStatus",
"registerType": "status",
"registerOffset": "3.4"
},
"channelFaultStatus": {
"registerName": "channelFaultStatus",
"registerType": "status",
"registerOffset": "3.5"
},
"precisionSP": {
"registerName": "precisionSP",
"registerType": "cfg",
"registerOffset": "4"
},
"scaleMinSP": {
"registerName": "scaleMinSP",
"registerType": "cfg",
"registerOffset": "5"
},
"scaleMaxSP": {
"registerName": "scaleMaxSP",
"registerType": "cfg",
"registerOffset": "6"
},
"hhighSP": {
"registerName": "hhighSP",
"registerType": "cfg",
"registerOffset": "7"
},
"highSP": {
"registerName": "highSP",
"registerType": "cfg",
"registerOffset": "8"
},
"lowSP": {
"registerName": "lowSP",
"registerType": "cfg",
"registerOffset": "9"
},
"llowSP": {
"registerName": "llowSP",
"registerType": "cfg",
"registerOffset": "10"
},
"lllowSP": {
"registerName": "lllowSP",
"registerType": "cfg",
"registerOffset": "11"
},
"hhighDelayTimerSP": {
"registerName": "hhighDelayTimerSP",
"registerType": "cfg",
"registerOffset": "12"
},
"highDelayTimerSP": {
"registerName": "highDelayTimerSP",
"registerType": "cfg",
"registerOffset": "13"
},
"lowDelayTimerSP": {
"registerName": "lowDelayTimerSP",
"registerType": "cfg",
"registerOffset": "14"
},
"llowDelayTimerSP": {
"registerName": "llowDelayTimerSP",
"registerType": "cfg",
"registerOffset": "15"
},
"lllowDelayTimerSP": {
"registerName": "lllowDelayTimerSP",
"registerType": "cfg",
"registerOffset": "16"
}
}
}
},
"states": {
"active": {
"entry": [
"buildRegisterTransfomers"
],
"on": {
"setData": "setData"
}
},
"setData": {
"entry": [
"setData"
],
"target": "active"
}
}
},
"LT1002": {
"id": "LT1002",
"initial": "active",
"context": {
"id": "5f3ff5116a586089805ae300",
"registerTransformers": {},
"spec": {
"deviceVersion": 1.1,
"registers": {
"deviceTypeStatus": {
"registerName": "deviceTypeStatus",
"registerType": "status",
"registerOffset": "0"
},
"deviceVersionStatus": {
"registerName": "deviceVersionStatus",
"registerType": "status",
"registerOffset": "1"
},
"scaledValueStatus": {
"registerName": "scaledValueStatus",
"registerType": "status",
"registerOffset": "2"
},
"alarmStatus": {
"registerName": "alarmStatus",
"registerType": "status",
"registerOffset": "3"
},
"hhighAlarmStatus": {
"registerName": "hhighAlarmStatus",
"registerType": "status",
"registerOffset": "3.0"
},
"highAlarmStatus": {
"registerName": "highAlarmStatus",
"registerType": "status",
"registerOffset": "3.1"
},
"lowAlarmStatus": {
"registerName": "lowAlarmStatus",
"registerType": "status",
"registerOffset": "3.2"
},
"llowAlarmStatus": {
"registerName": "llowAlarmStatus",
"registerType": "status",
"registerOffset": "3.3"
},
"lllowAlarmStatus": {
"registerName": "lllowAlarmStatus",
"registerType": "status",
"registerOffset": "3.4"
},
"channelFaultStatus": {
"registerName": "channelFaultStatus",
"registerType": "status",
"registerOffset": "3.5"
},
"precisionSP": {
"registerName": "precisionSP",
"registerType": "cfg",
"registerOffset": "4"
},
"scaleMinSP": {
"registerName": "scaleMinSP",
"registerType": "cfg",
"registerOffset": "5"
},
"scaleMaxSP": {
"registerName": "scaleMaxSP",
"registerType": "cfg",
"registerOffset": "6"
},
"hhighSP": {
"registerName": "hhighSP",
"registerType": "cfg",
"registerOffset": "7"
},
"highSP": {
"registerName": "highSP",
"registerType": "cfg",
"registerOffset": "8"
},
"lowSP": {
"registerName": "lowSP",
"registerType": "cfg",
"registerOffset": "9"
},
"llowSP": {
"registerName": "llowSP",
"registerType": "cfg",
"registerOffset": "10"
},
"lllowSP": {
"registerName": "lllowSP",
"registerType": "cfg",
"registerOffset": "11"
},
"hhighDelayTimerSP": {
"registerName": "hhighDelayTimerSP",
"registerType": "cfg",
"registerOffset": "12"
},
"highDelayTimerSP": {
"registerName": "highDelayTimerSP",
"registerType": "cfg",
"registerOffset": "13"
},
"lowDelayTimerSP": {
"registerName": "lowDelayTimerSP",
"registerType": "cfg",
"registerOffset": "14"
},
"llowDelayTimerSP": {
"registerName": "llowDelayTimerSP",
"registerType": "cfg",
"registerOffset": "15"
},
"lllowDelayTimerSP": {
"registerName": "lllowDelayTimerSP",
"registerType": "cfg",
"registerOffset": "16"
}
}
}
},
"states": {
"active": {
"entry": [
"buildRegisterTransfomers"
],
"on": {
"setData": "setData"
}
},
"setData": {
"entry": [
"setData"
],
"target": "active"
}
}
},
"P101": {
"id": "P101",
"initial": "active",
"context": {
"id": "5f3ff5126a586089805ae302",
"registerTransformers": {},
"spec": {
"deviceVersion": 1.1,
"registers": {
"deviceTypeStatus": {
"registerName": "deviceTypeStatus",
"registerType": "status",
"registerOffset": "0"
},
"deviceVersionStatus": {
"registerName": "deviceVersionStatus",
"registerType": "status",
"registerOffset": "1"
},
"pumpMaxFrequencyStatus": {
"registerName": "pumpMaxFrequencyStatus",
"registerType": "status",
"registerOffset": "2"
},
"pumpFrequencyStatus": {
"registerName": "pumpFrequencyStatus",
"registerType": "status",
"registerOffset": "3"
},
"pumpMaxVoltageStatus": {
"registerName": "pumpMaxVoltageStatus",
"registerType": "status",
"registerOffset": "4"
},
"pumpVoltageStatus": {
"registerName": "pumpVoltageStatus",
"registerType": "status",
"registerOffset": "5"
},
"pumpMaxCurrentStatus": {
"registerName": "pumpMaxCurrentStatus",
"registerType": "status",
"registerOffset": "6"
},
"pumpCurrentStatus": {
"registerName": "pumpCurrentStatus",
"registerType": "status",
"registerOffset": "7"
},
"pumpMaxTemperatureStatus": {
"registerName": "pumpMaxTemperatureStatus",
"registerType": "status",
"registerOffset": "8"
},
"pumpTemperatureStatus": {
"registerName": "pumpTemperatureStatus",
"registerType": "status",
"registerOffset": "9"
},
"pumpRunningStatus": {
"registerName": "pumpRunningStatus",
"registerType": "status",
"registerOffset": "10"
},
"pumpModeStatus": {
"registerName": "pumpModeStatus",
"registerType": "status",
"registerOffset": "11"
},
"pumpOffModeStatus": {
"registerName": "pumpOffModeStatus",
"registerType": "status",
"registerOffset": "11.0"
},
"pumpAutoModeStatus": {
"registerName": "pumpAutoModeStatus",
"registerType": "status",
"registerOffset": "11.1"
},
"pumpManualModeStatus": {
"registerName": "pumpManualModeStatus",
"registerType": "status",
"registerOffset": "11.2"
},
"alarmStatus": {
"registerName": "alarmStatus",
"registerType": "status",
"registerOffset": "12"
},
"pumpFaultStatus": {
"registerName": "pumpFaultStatus",
"registerType": "status",
"registerOffset": "12.0"
},
"pressureFaultStatus": {
"registerName": "pressureFaultStatus",
"registerType": "status",
"registerOffset": "12.1"
},
"vfdFaultStatus": {
"registerName": "vfdFaultStatus",
"registerType": "status",
"registerOffset": "12.2"
},
"gfciFaultStatus": {
"registerName": "gfciFaultStatus",
"registerType": "status",
"registerOffset": "12.3"
},
"cleanStarinerWarningStatus": {
"registerName": "cleanStarinerWarningStatus",
"registerType": "status",
"registerOffset": "12.4"
},
"networkFaultStatus": {
"registerName": "networkFaultStatus",
"registerType": "status",
"registerOffset": "12.5"
},
"inputSetPumpFrequency": {
"registerName": "inputSetPumpFrequency",
"registerType": "input",
"registerOffset": "13"
},
"inputTogglePumpMode": {
"registerName": "inputTogglePumpMode",
"registerType": "input",
"registerOffset": "14"
},
"inputTriggerPumpStart": {
"registerName": "inputTriggerPumpStart",
"registerType": "input",
"registerOffset": "15"
},
"precisionSP": {
"registerName": "precisionSP",
"registerType": "cfg",
"registerOffset": "16"
},
"psllDelayTimerSP": {
"registerName": "psllDelayTimerSP",
"registerType": "cfg",
"registerOffset": "17"
},
"pslDelayTimerSP": {
"registerName": "pslDelayTimerSP",
"registerType": "cfg",
"registerOffset": "18"
}
}
}
},
"states": {
"active": {
"entry": [
"buildRegisterTransfomers"
],
"on": {
"setData": "setData"
}
},
"setData": {
"entry": [
"setData"
],
"target": "active"
}
}
},
"P102": {
"id": "P102",
"initial": "active",
"context": {
"id": "5f3ff5126a586089805ae304",
"registerTransformers": {},
"spec": {
"deviceVersion": 1.1,
"registers": {
"deviceTypeStatus": {
"registerName": "deviceTypeStatus",
"registerType": "status",
"registerOffset": "0"
},
"deviceVersionStatus": {
"registerName": "deviceVersionStatus",
"registerType": "status",
"registerOffset": "1"
},
"pumpMaxFrequencyStatus": {
"registerName": "pumpMaxFrequencyStatus",
"registerType": "status",
"registerOffset": "2"
},
"pumpFrequencyStatus": {
"registerName": "pumpFrequencyStatus",
"registerType": "status",
"registerOffset": "3"
},
"pumpMaxVoltageStatus": {
"registerName": "pumpMaxVoltageStatus",
"registerType": "status",
"registerOffset": "4"
},
"pumpVoltageStatus": {
"registerName": "pumpVoltageStatus",
"registerType": "status",
"registerOffset": "5"
},
"pumpMaxCurrentStatus": {
"registerName": "pumpMaxCurrentStatus",
"registerType": "status",
"registerOffset": "6"
},
"pumpCurrentStatus": {
"registerName": "pumpCurrentStatus",
"registerType": "status",
"registerOffset": "7"
},
"pumpMaxTemperatureStatus": {
"registerName": "pumpMaxTemperatureStatus",
"registerType": "status",
"registerOffset": "8"
},
"pumpTemperatureStatus": {
"registerName": "pumpTemperatureStatus",
"registerType": "status",
"registerOffset": "9"
},
"pumpRunningStatus": {
"registerName": "pumpRunningStatus",
"registerType": "status",
"registerOffset": "10"
},
"pumpModeStatus": {
"registerName": "pumpModeStatus",
"registerType": "status",
"registerOffset": "11"
},
"pumpOffModeStatus": {
"registerName": "pumpOffModeStatus",
"registerType": "status",
"registerOffset": "11.0"
},
"pumpAutoModeStatus": {
"registerName": "pumpAutoModeStatus",
"registerType": "status",
"registerOffset": "11.1"
},
"pumpManualModeStatus": {
"registerName": "pumpManualModeStatus",
"registerType": "status",
"registerOffset": "11.2"
},
"alarmStatus": {
"registerName": "alarmStatus",
"registerType": "status",
"registerOffset": "12"
},
"pumpFaultStatus": {
"registerName": "pumpFaultStatus",
"registerType": "status",
"registerOffset": "12.0"
},
"pressureFaultStatus": {
"registerName": "pressureFaultStatus",
"registerType": "status",
"registerOffset": "12.1"
},
"vfdFaultStatus": {
"registerName": "vfdFaultStatus",
"registerType": "status",
"registerOffset": "12.2"
},
"gfciFaultStatus": {
"registerName": "gfciFaultStatus",
"registerType": "status",
"registerOffset": "12.3"
},
"cleanStarinerWarningStatus": {
"registerName": "cleanStarinerWarningStatus",
"registerType": "status",
"registerOffset": "12.4"
},
"networkFaultStatus": {
"registerName": "networkFaultStatus",
"registerType": "status",
"registerOffset": "12.5"
},
"inputSetPumpFrequency": {
"registerName": "inputSetPumpFrequency",
"registerType": "input",
"registerOffset": "13"
},
"inputTogglePumpMode": {
"registerName": "inputTogglePumpMode",
"registerType": "input",
"registerOffset": "14"
},
"inputTriggerPumpStart": {
"registerName": "inputTriggerPumpStart",
"registerType": "input",
"registerOffset": "15"
},
"precisionSP": {
"registerName": "precisionSP",
"registerType": "cfg",
"registerOffset": "16"
},
"psllDelayTimerSP": {
"registerName": "psllDelayTimerSP",
"registerType": "cfg",
"registerOffset": "17"
},
"pslDelayTimerSP": {
"registerName": "pslDelayTimerSP",
"registerType": "cfg",
"registerOffset": "18"
}
}
}
},
"states": {
"active": {
"entry": [
"buildRegisterTransfomers"
],
"on": {
"setData": "setData"
}
},
"setData": {
"entry": [
"setData"
],
"target": "active"
}
}
}
}
}
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment